Customize the tmux status bar by adding configuration options to your ~/.tmux.conf
file. You can modify colors, content, positioning, and formatting using commands like set -g status-style
, set -g status-left
, and set -g status-right
. After making changes, reload your configuration with Ctrl+b : source-file ~/.tmux.conf
.
set -g status-style "bg=black,fg=white"
The tmux status bar provides essential information about your current session, windows, and system status. Customizing it can enhance your workflow and make tmux more visually appealing.
# Turn the status bar on/off set -g status on # or set -g status off # Set status bar position (top/bottom) set -g status-position top # or set -g status-position bottom # Set status bar refresh interval (seconds) set -g status-interval 5 # Set status bar background and foreground colors set -g status-style "bg=black,fg=white"
These basic settings control the visibility, position, update frequency, and colors of your status bar.
The tmux status bar has three main sections: left, center (window list), and right:
# Left side content set -g status-left "[#S] " set -g status-left-length 20 # Right side content set -g status-right "%H:%M %d-%b-%y" set -g status-right-length 40 # Center content (window list) set -g window-status-format "#I:#W" set -g window-status-current-format "#I:#W"
In these examples:
#S
represents the session name#I
represents the window index#W
represents the window name%H:%M %d-%b-%y
is a date/time format# Window list styling set -g window-status-style "fg=cyan,bg=default" set -g window-status-current-style "fg=black,bg=cyan,bold" # Left side styling set -g status-left-style "fg=green,bold" # Right side styling set -g status-right-style "fg=yellow"
These settings give different colors to each section of the status bar, with special highlighting for the current window.
You can create more complex status bars using special characters, conditional formatting, and system information:
# Show host, session, and window/pane information set -g status-left "#[fg=green]#h #[fg=yellow][#S] #[fg=cyan]#I:#P" # Show date, time, and system load set -g status-right "#[fg=cyan]#{cpu_percentage} #[fg=yellow]%H:%M:%S #[fg=green]%d-%b-%y" # Show special indicators for window status set -g window-status-format "#[fg=cyan]#I#[fg=white]:#[fg=cyan]#W#[fg=cyan]#F" set -g window-status-current-format "#[bg=cyan,fg=black,bold]#I:#W#F"
In these examples:
#h
shows the hostname#P
shows the pane index#F
shows window flags (like zoom state)#{cpu_percentage}
is a plugin variable showing CPU usage