Update 2nd September 2011: It seems I forgot to write how to configure gnome-terminal to keep the original title. In Profile Preferences go to Title and Command and set When terminal commands set their own titles to Prepend initial title.
Stumpwm is an excellent tiling window manager written entirely in Common Lisp. It is fully keyboard driven and hackable to the fullest. The wm is running in it’s own CLisp REPL, so you can connect with Slime+Emacs and hack directly. It is super easy to customize the wm, simply re-evaluate and you are good to go!
cmus is an equally awesome program I enjoy using, a very efficient music player that runs in a terminal emulator.
I wanted to have a keybinding either bringing cmus in focus, or starting it if it isn’t running. As cmus is running in a terminal emulator, it wasn’t straight forward how to achieve this. I am using the Gnome Terminal, so this solution will have to be modified to work with other terminals. Of course, the code is added to the
.stumpwm file, but you could also just evaluate it to try it out.
1 2 3 4
Now I just have to bind the command to an appropriate key
This works because I set the title of the terminal when I launch it. cmus changes the title based on what song is playing, so it will not work without doing this.