tmux status bar configuration

user131441 picture user131441 · Mar 9, 2012 · Viewed 106.7k times · Source

How is the status bar is customized? I noticed in this youtube video (at 3:05 - image below), the status bar looks very different than the default one that I see after installing tmux on my Mac OS X.

In particular, I like how the middle of the status bar shows the current program and the left side shows the name of only the current session. In comparison, my setup shows the name of all of the sessions and doesn't show the current application (for the currently focused pane).

If anyone could show me a sample configuration that could do this or show me where I can find the customization rules, that would be great! Thanks!

enter image description here

Update: In case anyone is curious, I was able to customize a status bar that is similar to the one seen in the video (minor tweaks) and you can find my config file on my github if you'd like to see an example.

Answer

jasonwryan picture jasonwryan · Mar 9, 2012

The man page has very detailed descriptions of all of the various options (the status bar is highly configurable). Your best bet is to read through man tmux and pay particular attention to those options that begin with status-.

So, for example, status-bg red would set the background colour of the bar.

The three components of the bar, the left and right sections and the window-list in the middle, can all be configured to suit your preferences. status-left and status-right, in addition to having their own variables (like #S to list the session name) can also call custom scripts to display, for example, system information like load average or battery time.

The option to rename windows or panes based on what is currently running in them is automatic-rename. You can set, or disable it globally with:

setw -g automatic-rename [on | off]

The most straightforward way to become comfortable with building your own status bar is to start with a vanilla one and then add changes incrementally, reloading the config as you go.1

You might also want to have a look around on github or bitbucket for other people's conf files to provide some inspiration. You can see mine here2.



1 You can automate this by including this line in your .tmux.conf:

bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."

You can then test your new functionality with Ctrlb,Shiftr. tmux will print a helpful error message—including a line number of the offending snippet—if you misconfigure an option.

2 Note: I call a different status bar depending on whether I am in X or the console - I find this quite useful.