[Xmonad] Gnome with xmonad HowTo
alextarkovsky at gmail.com
Tue Sep 18 05:53:55 EDT 2007
This is a follow-up to the earlier thread "How to combine xmonad with
Ubuntu". With the help of Spencer Janssen I was able to get xmonad 0.3
to act as a replacement for Metacity in a normal Gnome/GDM session (see
the nice screenshot at ). This means that xmonad is managed by
gnome-session and in turn GDM, such that logging out of Gnome the usual
way exits both Gnome and xmonad then returns to the GDM login screen.
There's still some problem areas in this scheme and it's tricky to set
up properly (it's not automatic yet), but it's sufficiently usable that
I've decided I can finally abandon Metacity and its "piles of crap"
window management paradigm. ;)
Here I'll explain how to duplicate my setup and give some tips and
caveats. Note that I'm using Gnome 2.18.3 with X.org 7.3 on Gentoo so YMMV.
What you'll need:
* Gnome working with some other window manager
* A working xmonad setup (i.e. you already know the basics of xmonad)
* The sources for xmonad and the xmonad extensions
Open xmonad's Config.hs in your editor and do the following:
1. In the imports section add:
2. Change "defaultGaps" to the same height value (in pixels) that your
gnome-panel is set to. Mine is 24 pixels so I use:
defaultGaps = [(24,0,0,0)]
3. In the "keys" key bindings list, add:
, ((modMask, xK_d ), withFocused demanage)
4. Also in the key bindings list, if gnome-terminal is your preferred
xterm, you'll probably want to change this line:
[ ((modMask .|. shiftMask, xK_Return), spawn "xterm") -- @@ Launch an
[ ((modMask .|. shiftMask, xK_Return), spawn "gnome-terminal") -- @@
Launch an xterm
Finally, recompile xmonad with the new DeManage extension.
Gnome Session Preparation
Before we start Gnome with xmonad we need to set up a custom session for
gnome-session using your current session as a template.
Launch Gnome as usual, then back up your existing ~/.gnome2/session file
in case you need to revert back to your current Gnome setup. Next,
launch System --> Preferences --> Sessions (or at the command line,
gnome-session-properties) and perform the following:
1. In the Startup Programs tab, click New and add a launcher called
"xmonad" which has the command "/usr/bin/xmonad", then click OK. Make
sure the new entry's box is checked.
2. In the Current Session tab, if there's any nautilus items in the
list, select them and set their Style to "Trash".
3. Do the same for any metacity items you see, and also for any items
which have no icon in the Style column.
4. Click Apply.
5. In the Session Options tab, click "Save the current session" and then
Now log out of Gnome.
Starting Gnome with xmonad
At the GDM login screen select "GNOME" for a new session (don't simply
use "Last session", as this seems to use a cache of your old session)
then log in.
You should see the Gnome splash screen briefly, and then a huge
gnome-panel taking up the entire screen sans the gap. Don't panic --
this is just where we have to force things a bit.
Make sure you're focused on the panel's window then hit Mod-d. DeManage
will work its magic, decoupling the panel from xmonad. Now right-click
on the panel, select Properties, and in the General tab you'll see a
combo box labeled "Orientation". First set the orientation to "Left",
then "Bottom", then "Top". If your setup is like mine, that's the lucky
combination that lands the panel -- properly sized -- into the gap,
right where we want it. If not, try moving it around a bit more with the
Orientation until it behaves.
Xmonad 0.4 is rumored to make all this silliness moot by properly
handling the panel positioning automatically. Until then, you're stuck
with performing this routine each time you log into Gnome.
Now that we've got that out of the way, pull up the preferences for your
Gnome session again, and in the Current Session tab, find the entry for
xmonad and change its Order from 50 to 51, click Apply, then in the
Session Options tab click "Save the current session" and then Close.
This is extra insurance that xmonad will be started last in every
session from now on. You'll only need to do this once.
So that's pretty much it -- you're now running Gnome with xmonad instead
of Metacity. Launch an xterm and some applications, and confuse your
friends and enemies. ;)
Below are a few tips and things to look out for.
* Background Image: You can set an image as xmonad's background just as
you might set a normal desktop background. In GConf, navigate to desktop
--> gnome --> background, check the "set_background" option, then set
the value of "picture_filename" to the path of your image.
* Trash: Since you'll no longer have a "desktop" to place it on (see the
Nautilus blurb below), put your Trash icon in the panel by adding a
Trash applet there.
* Nautilus: Nautilus can't be used to draw the desktop because xmonad
places the desktop in an always-on-top floating window which can't be
closed using Mod-Shift-C (although it can be dragged around with
Mod-mousebutton1). One workaround is to turn off desktop drawing: Open
GConf, navigate to apps --> nautilus --> preferences, and un-check the
"show_desktop" option (don't forget to restart Nautilus if it's already
running). This is the equivalent of using `nautilus --no-desktop` globally.
* Window List and Window Selector panel applets: Windows don't appear to
be registering themselves with these properly, so they remain empty. No
* Deskbar panel applet: The pop-up entry dialog for Deskbar, if its
Layout preference is set to "Button in panel", doesn't appear as a
floating dialog but rather as a normal window. This doesn't hinder
functionality at all, however it's ugly and disruptive to the workspace
layout. One workaround is to set Deskbar's Layout preference to "Entry
* Dock mode applications: Xmonad doesn't handle the "dock" property of
windows properly yet, so apps displaying in dock mode (GKrellM, Conky,
etc.) won't behave as expected. A general workaround: If possible set
the app to windowed mode instead; if not, you might try using the
DeManage extension and place the app in a gap.
More information about the Xmonad