October 27, 2007

Installing Xmonad on Ubuntu

Xmonad is the new kid on the block among the tiling window managers. Tiling window managers (some of the other prominent ones being ratpoison, dwm or Ion, arrange windows automatically to tile the screen without overlap or gaps, maximizing screen usage. To those who remember the tiling windows in old Windows and Mac systems, this might seem like a step backward. But in todays world of wide screen monitors and multi-head displays, tiling window managers can be highly productive, not to mention the fact that the mouse is mostly superfluous in most of these window managers. Anyway, it doesnt hurt to try it out and a choice of window managers is one of the fantastic things about Linux. If you just want to try out a tiling window manager, dwm is available in the Ubuntu repos. But if you want to try Xmonad, you have to build it from source. This is what worked for me. Most of the instructions are based on those given at the site, but some modifications are needed for the specific dependencies in Ubuntu and to install the latest version of Xmonad. These are the instructions for installing on Ubuntu Feisty and have not been tested on Gutsy.

1. Install the Haskell compiler and the mtl core library.


sudo aptitude install ghc6
sudo aptitude install libghc6-mtl-dev


2. Download and install the X11 bindings for Haskell


cd /tmp
wget http://hackage.haskell.org/packages/archive/X11/1.2.2/X11-1.2.2.tar.gz
tar -xzf X11-1.2.2.tar.gz
cd X11-1.2.2
runhaskell Setup.hs configure --prefix=$HOME
runhaskell Setup.hs build
runhaskell Setup.hs install --user
cd ..


3. Download and install the X11-extras bindings


wget http://hackage.haskell.org/packages/archive/X11-extras/0.4/X11-extras-0.4.tar.gz
tar -xzf X11-extras-0.4.tar.gz
cd X11-extras-0.4
runhaskell Setup.lhs configure --prefix=$HOME
runhaskell Setup.lhs build
runhaskell Setup.lhs install --user
cd ..


4. Install dmenu and dzen (Optional, provides status bar and menu)


sudo aptitude install dmenu

wget http://gotmor.googlepages.com/dzen2-latest.tar.gz
tar -xzf dzen2-latest.tar.gz
cd dzen2-0.8.5
sudo make clean install
cd gadgets
sudo make clean install


5. Download and build Xmonad


mkdir ~/xmonad
cd ~/xmonad
wget http://hackage.haskell.org/packages/archive/xmonad/0.4/xmonad-0.4.tar.gz
tar xzf xmonad-0.4.tar.gz
cd xmonad-0.4
runhaskell Setup.lhs configure --prefix=$HOME
runhaskell Setup.lhs build
runhaskell Setup.lhs install --user


Note that I have opted to store the xmonad source files in an accessible directory. Dont delete it yet. Any changes in the configuration of Xmonad are made in the source code and then you have to recompile the binary.

The best way to add xmonad to the gdm menu is to create a .xsession file. In the simplest form this will be


#~/.xsession
xmonad


Now when you log in you will have an option titled 'xsession script' and choosing it will launch xmonad. Look at the xmonad site to learn the keyboard shortcuts before you start. We have to configure xmonad to create a space for dzen and write some scripts to pipe some output to the dzen status bar. This and other customizations in the next post.

See my next post for setting up Xmonad.

October 15, 2007

Upgrading to Gutsy - lessons learnt

Having previously had problems when upgrading from Edgy to Feisty, I took extra care this time around. I saved an image of my root and home partitions (with partimage on systemrescue cd) to begin with. I then uninstalled Beryl and commented out unofficial repositories in my sources list. Having done that, I started the upgrade with 'update-manager -d' (needed only till the final release is out). The upgrade went quite well this time and soon I had gutsy running smoothly on my desktop. Few of the lessons I learnt were -

1. Dont know if it is required to uninstall Beryl, but that worked for me.
2. Good idea to make sure you have about 50o-1000 MB free space on your root partition before you start.
3. While it is not required to 'babysit' during the long upgrade process, check on it once in a while. Once, coming back after a couple of hours, I found it waiting for me to declare if I wanted to keep some old configuration files or change them.
4. Virtualbox worked after running the setup once. This made it easy since there is no package for gutsy at the virtualbox site and the repos only have the OSE (which is lacking in some features).

All in all, it was a pretty painless upgrade and if you are, like me, debating if you should upgrade or do a fresh install, it seems worthwhile trying the upgrade if you have the system already set up to your liking.