tmux instead of GNU screen

categories: blog

I use GNU screen a lot and most importantly on my servers so that a session is not lost after logging out. One of the screen features I use is the tiling feature. By pressing "C-a S" the terminal is split vertically into two regions. Unfortunately once come back after having detached from the session I manually have to split again and put my terminals on the upper and lower region. This is a whole lot of unnecessary keystrokes each time I connect to my server. Screen has no (and will not have) functionality to keep track of the tiling for each session so a hack to still preserve it, is to run a nested screen where the innermost screen is tiled but one only connects or detaches to the outer screen. This again has of course the disadvantage of longer keyboard shortcuts once one wants to manipulate the innermost screen. There are of course solutions like a different screen config for the outer screen and such but it still feels ugly.

So since that really botherd me and I heard of tmux which promised more functionality, better code, easier handling (modifiable keyboard shortcuts) and most importantly: it offered the functionality that I was looking for as explained above. Long story short: it works like a charm and I guess I have constantly switched now.

One thing to notice for users of the 1.3 version of tmux in Debian based operating systems: if you want to use the supplied screen configuration so that you have screen keyboard shortcuts in tmux (I do that) then after copying over /usr/share/doc/tmux/examples/screen-keys.conf to /etc/tmux.conf or ~/.tmux.conf, replace the down-pane command on line 96 with select-pane -U. You might also want to delete the entries for BTab.

A friend of mine got also saved by tmux - he was complaining that when using GNU screens multi-display-mode (screen -x) then if the one user changes terminals, this change is not done for the other. That sucks a lot if you want to help someone over a screen session. With tmux - this works out of the box :)

One drawback nonetheless is, that this hack to display a libnotify message on my laptop screen from a remote host over a ssh connection using the urxvt print-pipe doesnt work anymore. The problem is that tmux doesnt understand the \033[5i escape. NicM from #tmux said that printing something like "\033Ptmux;\033\033[5i\033\" with tmux HEAD would work but i didnt try it out. Since this approach doesnt work anymore I now switched to simple taskbar highlighting for notifying me that stuff is going on in one of my remote hosts. For this to work i just had to set "URxvt.urgentOnBell: true" in my ~/.Xdefaults. Whenever the bell character "\a" is printed the window will now flash. In my jabber client mcabber i also have to set "set beep_on_message = 1" and comment the "#set events_command" line that was putting the print escapes to stderr before. Using awesome wm, switching to the workspace that requires attention is now even quicker by using the Modkey+U shortcut.

View Comments
blog comments powered by Disqus