I have been posting quite a bit about tmux of late1. It is a marvellous application and lends itself to all sorts of interesting uses. When you first install it, you will find a number of user config files in /usr/share/tmux/. I started with tmux by copying Thayer’s config across and then working up from there. There is a section at the bottom of this file that has always puzzled me, and so I decided to get to the bottom of it.
1 2 |
|
It is a great idea. If you are running tmux in X, then you have dwm’s status bar telling you what the time is, how much battery you have left etc,. You don’t need to replicate that functionality in tmux. If, however, you are in the console, you don’t have that information, unless you print it in tmux’s statusbar.
I had tried to get this to work once or twice over the last couple of years, but never persevered with it. However, as I have been doing a bit of work making the console as functional as possible2, I thought I would revisit it.
The insight that I had that got it working for me was to use the source-file option in .tmux.conf to call the relevant statusbar, depending if X was running or not. I just adapted Thayer’s code, like so:
1 2 3 |
|
And then created those files with the desired statusbar options. So, for example, if I am running tmux in the console, $HOME/.tmux/xless is loaded:
1 2 3 4 5 |
|
Which prints a statusbar with the time and battery left on my laptop3:
All the relevant files are in my mercurial repo.
Notes
Copy & paste in tmux, Sessions in tmux & Introduction to tmux
Image squashed to fit the requirements of this blog…