XMonad and Gnome

Hey there. This is how I am setting up XMonad to run with Gnome on my Ubuntu 10.04 install.

Presumably, this will work with most Gnome set-ups.

My desire is to have a session available from GDM that uses Gnome but with XMonad as my window manager. I’ll also be using xmobar. If you want to use xmonad and xmobar, you should be able to figure out how to install them on your own distribution.

So, I have everything installed. First thing I’m going to do is create a new session that is available in my GDM login. If you have installed XMonad, you likely have an xmonad.desktop in /usr/share/xsessions. This will just run an XMonad session. I want to run XMonad with Gnome so I’m going to copy this file to xmonad-gnome.desktop and edit it slightly so that it looks like this:

[Desktop Entry]
Encoding=UTF-8
Name=XMonad-Gnome
Comment=Lightweight tiling window manager
Exec=xmonad-gnome
Icon=xmonad.png
Type=XSession

The difference is that the name is XMonad-Gnome. That’s what I’ll select at the sessions option at the GDM login. Another good name could be Gonad. Also, the Exec is now xmonad-gnome. xmonad-gnome is the name of an executable that I have to create. It will tell xmonad and gnome how to play together. We have to create this script ourselves and make sure it’s executable and somewhere in our path.

A safe place to put the xmonad-gnome script is in /usr/local/bin. I’m going to put mine in ~/bin because that’s where I sometimes keep little scripts. Also, if I ever need to change things I won’t need root access to edit it. Just make sure it’s in your path somewhere.

Here’s my xmonad-gnome file:


#!/bin/bash
export WINDOW_MANAGER=xmonad
gconftool-2 -u /desktop/gnome/session/required_components/windowmanager
urxvtd -f -o &
gnome-session

Be careful here, “gconftool-2 -u /desktop/gnome/session/required_components/windowmanager” should be all on one line. WordPress may be trying to be pretty here and I don’t want to take the time to figure out how to keep this all on one line. Tell me in the comments!

The line urxvtd -f -o & is an example of a start up program. If you don’t have any that you know about, just ignore that line. If you have start up things (conky maybe?) you’ll probably want to call them here, or put them all in a start up file and then call that file here.

Ok. We are at the home stretch. Now we need to make our xmonad configuration. Your configuration should live in ~/.xmonad/xmonad.hs. This file, at minimum should look like this:

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

(IMPORTANT NOTE: It seems that wordpress is not interested in preserving white space. If you try these configs and they don’t work, try putting in some spaces where it makes sense. Or if you get stuck, write me in the comments and I’ll do my best to help you out.)

Feel free to try this out, now. Log out and log back in. Don’t forget to select XMonad-Gnome session at the log in. To get a terminal, hit Alt-Shift-Enter. It will be the typical gnome-terminal. You’ll also still have your panels. At this point you should look up XMonad’s default key bindings or make up your own configuration. I might eventually post my xmonad.hs especially if I get requests.

I don't know anything about haskell. I just picked up stuff here and there and recognized patterns.
This should be more than enough to get you started. Enjoy!

Advertisements

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: