I am a big fan of XMonad and I use it as my window manager inside of Gnome. My only problem was a terrible startup time; it took me more than one minute to log into my session. I knew it was a problem with my configuration and I finally decided to investigate it.

I looked at ~/.xsessions-errors and found the following messages:

gnome-session[1908]: WARNING: Application 'xmonad.desktop' failed to register before timeout
gnome-session[1908]: CRITICAL: We failed, but the fail whale is dead.


After a little bit of duck-duck-fu, I found that the problem was with the following lines of my ~/.xmonad/xmonad.hs file:

main = do
xmonad $gnomeConfig { startupHook = setWMName "LG3D" , modMask = mod4Mask -- set the mod key to the windows key }  My startup hook was overriding Gnome's startup hook and XMonad was never registered, hence the timeout. The solution was to combine both startup hooks using the following lines instead: main = do xmonad$ gnomeConfig
{ startupHook = startupHook gnomeConfig >> setWMName "LG3D"
, modMask = mod4Mask -- set the mod key to the windows key
}


With this fix, my XMonad now starts in a couple of seconds.