Install XMonad with Gnome on Ubuntu 10.04 as a separate session

I tried doing this for a while, and a lot of the blog posts and tutorials did not work, or they did not allow me to choose between Xmonad+Gnome and just Gnome on login.

The closest one I found that worked was Below you’ll find my slightly modified version.

First, get xmonad using:

sudo apt-get install xmonad

This installs xmonad and gives an entry in our xsessions. But, we need to do some work to have xmonad and gnome work together.

First, let’s create ~/.xmonad/xmonad.hs and paste the following into it:

import XMonad
import XMonad.Util.EZConfig
import XMonad.Config.Gnome
main = xmonad $ gnomeConfig { terminal = "gnome-terminal" }

This tells xmonad to use the gnomeConfig they’ve supplied, and additionally to use the gnome terminal.

Now, let’s create a custom startup script to get xmonad and gnome to work together. You can create the script wherever. Since I’m the only user on this machine, I created mine in ~/

Paste the following code in your ~/ script:

export WINDOW_MANAGER=xmonad
gconftool-2 -u /desktop/gnome/session/required_components/windowmanager

This tells gnome to use the xmonad window manager. Also, it unsets the current windowmanager in gconf. Other tutorials forgot to mention to do this! Finally, it starts gnome-session which now uses xmonad.

In order for this to work we need to make the script executable, so run:

chmod +x ~/

We’re almost done. The last step is to modify /usr/share/xsessions/xmonad.desktop. Change it the following:

[Desktop Entry]
Comment=Lightweight tiling window manager

This tells xmonad to run the custom script.

Now we’re done. Logout, click your username to login, and on the bottom choose ‘Xmonad’ from the sessions. You should be running xmonad within gnome! You’ll notice there aren’t title bars on windows and things have a red border. See the Default Keyboard Bindings to start understanding how xmonad works.

Customizing XMonad while keeping gnome configurations
If you’d like to go a bit farther, here’s my customized xmonad.hs which keeps the gnome configurations. It changes xmonad so that when you cycle through layouts (mod space), you cycle through the default “tiled” layout and then you cycle through a full screen tabbed layout.

import XMonad
import XMonad.Util.EZConfig
import XMonad.Config.Desktop
import XMonad.Config.Gnome
import XMonad.Layout.Tabbed
myLayout = (desktopLayoutModifiers $ tiled) ||| simpleTabbed
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio
    -- The default number of windows in the master pane
    nmaster = 1
    -- Default proportion of screen occupied by master pane
    ratio   = 1/2
    -- Percent of screen to increment by when resizing panes
    delta   = 3/100
main = xmonad $ gnomeConfig{ terminal = "gnome-terminal",layoutHook = myLayout}

One response to “Install XMonad with Gnome on Ubuntu 10.04 as a separate session”

  1. somebody says:

    I created a separate session file as in the link you suggested, but setting “Exec=~/” didn’t work. I had to use the full path to the home folder, ie. “Exec=/home/username/”.

Leave a Reply

Your email address will not be published. Required fields are marked *