Xmonad on Lucid Lynx

While Gnome on Lucid Lynx is pretty and Gnome has a bunch of features that make window management a bit nicer than before (like Win-w,e,s,n,m) I immediately longed for a decent tiling manager. So, within ten minutes and without further regret:

Get the latest xmonad packages

Unlike Karmic, Lucid repositories have the latest version of Xmonad (0.9).

$ sudo apt-get update
$ sudo apt-get install xmonad dwm-tools feh

Switch window manger

If you’ve installed vanilla Ubuntu 10.04, you’ll want to switch from gnome-wm to xmonad.

$ gconftool-2 -g /desktop/gnome/session/required_components/windowmanager
$ gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string

Start xmonad from script

We’re changing one line of xmonad.desktop. Rather than start xmonad directly, we want to run the xmonad.start script.

$ sed s:^Exec=xmonad$:Exec=xmonad.start: /usr/share/xsessions/xmonad.desktop > ~/tmp.xmonad
$ sudo mv ~/tmp.xmonad /usr/share/xsessions/xmonad.desktop

$ sudo wget http://genaud.net/alex/2010/04/xmonad_files/xmonad.start -O /usr/local/bin/xmonad.start
$ sudo chmod +x /usr/local/bin/xmonad.start

Configure your own xmonad session

Note, you’ll need to type colon-quit (:quit) to exit the haskell compiler (ghci). Hopefully all modules load OK.

$ mkdir ~/.xmonad
$ wget http://genaud.net/alex/2010/05/xmonad.hs -O ~/.xmonad/xmonad.hs
$ ghci ~/.xmonad/xmonad.hs

Configure xmobar

Xmobar is activated from Win-p. Just start typing the first few characters of the command you want and hit enter.

$ wget http://genaud.net/alex/2010/04/xmonad_files/.xmobarrc -O ~/.xmobarrc

Finishing touches

Remove all the panel clutter and add pretty background image.

  • Delete the bottom panel ( Right click > Delete This Panel )
  • Autohide top panel ( Right click > Properties > Autohide )
  • Set a desktop image by uncommenting and modifying the “feh --bg-scale” line of /usr/local/bin/xmonad.start

Log in to xmonad session

The moment of truth… (oh wait, if you’ve never used xmonad before, take a look at the next section before it’s too late).

  • Log out
  • Click on your user
  • Select Sessions:xmonad (from the bottom, was GNOME)
  • Type password and Log In

Five important commands

There are more than a dozen commands. But that’s it. The steep learning curve immediately plateaus. Print a cheat sheet and you’ll be a tiling window master in no time. Here are perhaps the most important commands:

  • Win-Shift-Return – to open a terminal window
  • Win-Space – toggle between three columns, two columns, two rows, and full screen
  • Win-Return – make selected window the master window
  • Win-h – shrink master window
  • Win-l – expand master window

Some more commands

  • Win-Shift-c – close selected window
  • Win-1 (or 2,3,4,5,6,7,8,9) – switch workspace
  • Win-Shift-1 (or 2,3,4,5,6,7,8,9) – switch selected window to another workspace
  • Win-j (or Win-Tab) – select next window
  • Win-k (or Win-Shift-Tab) – select previous window
  • Win-Shift-j – switch selected window with next window
  • Win-Shift-k – switch selected window with previous window
  • Win-, – add another window to master area
  • Win-. – remove a window to master area
  • Win-p – start typing a program name, say “nau” for “nautilus”
  • Win-q – restart xmonad (useful after modifying xmonad.hs config)
  • Win-Shift-q – quit xmonad (quick way to log out)

If you Win-(left-mouse drag) you’ll pop (un-tile) a floating window. You can Win-(right-mouse drag) to change the size and Win-t to set the window back into the tile layout. Some people like this and claim it makes working with Gimp or other dialog boxes easier. At least one person disagrees.

In the animated sequence below, we have three windows. The spreadsheet (white) is the master along with two terminals. The animation demonstrates toggling between two full screen windows, then cycling through four layouts from full screen, three column, two column, two rows, and back to full screen. From the keyboard that would be: Win-j, Win-k, Win-Space, Win-Space, Win-Space, Win-Space, ad nauseum.

toggling between four different layouts