How to colorize last window in status line

tmux

I'd like to make the last selected window (the one to which :last-window takes you) to stand out visually. By default it's just marked with an inconspicuous - after the name.

Is there a way to set the attributes for last window name in the status line, like set-option window-status-current does for the current window name?

Update: Both Debian Wheezy (stable) and Ubuntu 12.04 have tmux 1.6 that lacks the necessary option. But there's a backport which is 1.9.

The solution was to upgrade.

Best Answer

I think there might be a version mis-match or something, but jasonwryan was on the right track for my purposes. I'm using tmux v1.8, and I see the following options in the man page that work:

         window-status-last-attr attributes
                 Set status line attributes for the last active window.

         window-status-last-bg colour
                 Set status line background colour for the last active window.

         window-status-last-fg colour
                 Set status line foreground colour for the last active window.

An example for your ~/.tmux.conf:

set -g window-status-last-attr bold
set -g window-status-last-fg blue

EDIT: Sure enough, these options were added for tmux v1.8. Thus, this answer is applicable for tmux versions >=1.8 only.

EDIT: Per jasonwryan, his solution is for v1.9+. After reviewing the changelog, the foo-{bg,fg,attr} commands are deprecated as of v1.9 and will be slowly phased out. Best to use jasonwryans solution if on v1.9+.

EDIT: Implemented this in the form of a pull request for the popular status line utility powerline. https://github.com/Lokaltog/powerline/pull/864. This pull request has since been merged.

Related Question