Image of the glider from the Game of Life by John Conway
Skip to content

My Tmux Hardstatus Theme

Recently, I've made the switch from GNU Screen to Tmux for my remote terminal multiplexor. I still prefer GNU Screen for serial connections, however (something the Tmux developers don't seem to think is important). So, when getting it setup, I wanted my hardstatus line to imitate my GNU Screen hardstatus line as closely as possible. Well, I got it to that point, then took it even further to work with my custom Irssi and ZSH themes (I want everything to tie in nicely). The only thing left is getting Mutt in order, but that's for another post.

At any event, here is the configuration for the theme:

1
2
3
4
5
6
7
8
9
10
11
12
# hardstatus line theme
set-option -g status-fg white
set-option -g status-bg default
set-option -g status-justify centre
set-option -g status-left-length 13
set-option -g status-left '#[fg=green][ #[fg=black,bright]#h #[fg=green,nobright]][#[default]'
set-option -g status-right-length 16
set-option -g status-right '#[fg=green]][ #[fg=black,bright]%m/%d %H:%M #[fg=green,nobright]]#[fg=default]'
set-window-option -g window-status-current-format '#[fg=red,bg=default]( #[fg=white,bright,bg=default]#I:#W#[fg=red,nobright,bg=default] )#[fg=default]'
set-window-option -g window-status-alert-attr bold
set-window-option -g window-status-alert-fg yellow
set-window-option -g window-status-alert-bg default

Obviously, this won't look that great on a terminal with a white background (or really any color other than black). And here is the screenshot:

As you can clearly see, the active window you're under is bold white with red parentheses around the window name. The previous window you were in is marked with a dash '-' (by default). An alert in a terminal will change the text to bold yellow, so long as you're not in that window (as you can see with the "mutt" window). It ties in nicely with the 88_madcows.theme file for Irssi, and the ZSH theme I built.

I'm new to building Tmux hardstatus lines, so if there is something I should be doing differently, let me know.

{ 2 } Comments

  1. Erik using Google Chrome 15.0.855.0 on GNU/Linux 64 bits | September 1, 2011 at 11:40 am | Permalink

    That looks pretty cool. One of the things I have in my status line is the session ID. Very helpful if you use named sessions or multiple sessions. The session ID can be displayed using the #S variable. I also put the load average to the right of the session name. Here's my status-right:

    set -g status-right '#[fg=red,bright]#S#[fg=white] | #[fg=green]#(cut -d " " -f 1-4 /proc/loadavg)'

  2. nm using Debian IceWeasel 11.0 on GNU/Linux 64 bits | March 28, 2012 at 9:32 pm | Permalink

    I've been having issue for a while after switch from screen to tmux, I experienced freezes at regular intervals, when I asked what could be the cause on #tmux (freenode) I was quickly replied: "Are you calling date by any chance ?"

    Then I remembered I got my hardstatus from this article.

    So here's the fixed version of your status:

    set-option -g status-right '#[fg=green]][ #[fg=black,bright]%d.%m %H:%M #[fg=green,nobright]]'

    Totally fixed my issue.

Post a Comment

Your email is never published nor shared.

Switch to our mobile site