How do I get xmonad to run with the GNOME fallback session?
I'm not having luck getting XMonad to run in 11.10 (x64, fresh install) with a gnome fallback session. I've tried adapting the instructions from
http://markhansen.co.nz/xmonad-ubuntu-lucid/
and
http://markhansen.co.nz/xmonad-ubuntu-oneiric/
but with no luck. If anyone has ideas, I'd like to hear them.
Solution 1:
How to use a custom window manager with the GNOME Classic session in 11.10
Exemplified with the sawfish window manager (sorry, I don't use xmonad).
1. Fix gnome-classic.session
There seems to be a bug in gnome-classic.session. Here's how to fix it:
Edit the system file /usr/share/gnome-session/sessions/gnome-classic.session directly or make a copy in your home directory:
mkdir ~/.config/gnome-session/sessions
cp -ai /usr/share/gnome-session/sessions/gnome-classic.session ~/.config/gnome-session/sessions/
Make this change:
[GNOME Session]
Name=GNOME Classic
RequiredComponents=gnome-panel;gnome-settings-daemon;
-RequiredProviders=windowmanager;notifications;
+RequiredProviders=windowmanager;
DefaultProvider-windowmanager=gnome-wm
DefaultProvider-notifications=notify-osd
IsRunnableHelper=/usr/lib/gnome-session/gnome-session-check-accelerated
FallbackSession=gnome-fallback
DesktopName=GNOME
2.1. Alternative 1: Set WINDOW_MANAGER in ~/.gnomerc
2.1.a. Create/edit ~/.gnomerc and add this:
export WINDOW_MANAGER=sawfish
Replace "sawfish" in this example with the window manager you want to use. If you now log in with the "GNOME Classic" session, you will get your chosen window manager.
2.1.b. Faster startup:
If you experience a 30 second delay at login with the above solution, the following will fix that (this might just be a sawfish issue).
Make a startup script, e.g. ~/bin/my-gnome-wm:
#!/bin/bash
sawfish &
Make it executable:
chmod u+x ~/bin/my-gnome-wm
Change ~/.gnomerc to this:
export WINDOW_MANAGER="$HOME/bin/my-gnome-wm"
2.2. Alternative 2: Use sawfish.desktop
2.2.a. Edit gnome-classic.session again:
[GNOME Session]
Name=GNOME Classic
RequiredComponents=gnome-panel;gnome-settings-daemon;
RequiredProviders=windowmanager;
-DefaultProvider-windowmanager=gnome-wm
+DefaultProvider-windowmanager=sawfish
DefaultProvider-notifications=notify-osd
IsRunnableHelper=/usr/lib/gnome-session/gnome-session-check-accelerated
FallbackSession=gnome-fallback
DesktopName=GNOME
Replace "sawfish" in this example with the window manager you want to use. This requires a file like "sawfish.desktop" to be installed in the correct location, e.g. /usr/share/applications/sawfish.desktop.
2.2.b. Faster startup:
If you experience a 30 second delay at login with the above solution, the following will fix that (this might just be a sawfish issue).
Edit the system file /usr/share/applications/sawfish.desktop directly or make a copy in your home directory:
mkdir ~/.local/share/applications
cp -ai /usr/share/applications/sawfish.desktop ~/.local/share/applications/
Make this change:
[Desktop Entry]
Name=Sawfish
Name[el]=Ðñéïíüøáñï (Sawfish)
Type=Application
-Exec=sawfish
+Exec=bash -c 'sawfish&'
TryExec=sawfish
Terminal=false
NoDisplay=true
X-GNOME-WMName=Sawfish
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-Autostart-Notify=true
Notes
With DefaultProvider-windowmanager=gnome-wm and without setting WINDOW_MANAGER in .gnomerc, we seem to get both Unity and GNOME Classic at the same time, on top of each other!
This entry in ~/.xsession-errors probably says something about why there is a 30 second delay:
gnome-session[23870]: WARNING: Application 'gnome-wm.desktop' failed to register before timeout
Why create the my-gnome-wm script? Because this doesn't seem to work:
export WINDOW_MANAGER='/usr/bin/sawfish&'
Neither does this:
export WINDOW_MANAGER='bash -c "/usr/bin/sawfish&"'
Solution 2:
A quick fix: Log in, then execute killall metacity & xmonad
.
It seems to work, though I'm having intermittent keyboard and mouse issues that may or may not be related to this solution.
Also, given that this works, you'd think I could just swap out the window manager value in /usr/share/gnome-session/sessions/gnome-classic.session, but when I change the value, nothing happens.
Solution 3:
For newer Ubuntu versions (e.g. 15.04), this repository is available. To install the needed files:
sudo add-apt-repository ppa:gekkio/xmonad
sudo apt-get update
sudo apt-get install gnome-session-xmonad
For Ubuntu 12.04, it almost works "out of the box" -- you need to install gnome panel manually:
sudo apt-get install gnome-panel
and then you can log in using the "GNOME with Xmonad" session from the login screen.
(source: http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_in_Gnome#Ubuntu_Precise)