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&"'