Have you ever felt that it is just annoying to use your mouse with a notebook? or that resizing manually windows as you need to see more? If yes Xmonad is for you. It is based on haskell.

It was quite easy to implement and replace metacity under gnome.

It is not so difficult to make it happen.

Here are the steps:
First we need to tell to gnome-session to use xmonad instead of metacity.

desktop ~/ $
gconftool-2 -s /desktop/gnome/session/required_components/windowmanager xmonad --type string

You need a file applications/xmonad.desktop to start xmonad at login.

desktop ~/ $  cat /usr/share/applications/xmonad.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Xmonad
Exec=xmonad
NoDisplay=true
X-GNOME-WMName=Xmonad
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-Autostart-Notify=true

Next to your gnome-session you need to run a separate xmonad session. For this you need a xsessions/xmonad.desktop

desktop ~/ $ cat /usr/share/xsessions/xmonad.desktop 
[Desktop Entry]
Encoding=UTF-8
Name=XMonad
Comment=Lightweight tiling window manager
Exec=xmonad
Icon=xmonad.png
Type=XSession

Than edit you X settings to run the ~/.xsession

desktop ~ $ cat /etc/X11/sessions/Xsessions.desktop
[Desktop Entry]
Name=Xsession
Comment=This runs ~/.xsession
Exec=/etc/X11/Xsession

Than edit the ~/.xsession

desktop ~ $ cat ~/.xsession
export WINDOW_MANAGER="/usr/bin/xmonad"
exec gnome-session

That’s all. Enjoy.

Everything can be customised to give you and idea here are my config files. inspired by the code of Øyvind ‘Mr.Elendig’ Heggstad
Here is my ~/.xmonad/xmonad.hs

desktop ~/.xmonad $
{- xmonad.hs
 - Author: dexter
 -}
 
-- Imports --
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import IO (Handle, hPutStrLn) 
 
-- utils
import XMonad.Util.Run (spawnPipe)
 
-- hooks
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
 
-- layouts
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
 
-- Main --
main = do
       h <- spawnPipe "/usr/bin/xmobar"
       xmonad $ defaultConfig
              { workspaces = workspaces'
              , modMask = modMask'
              , borderWidth = borderWidth'
              , normalBorderColor = normalBorderColor'
              , focusedBorderColor = focusedBorderColor'
              , terminal = terminal'
              , keys = keys'
              , logHook = logHook' h
              , layoutHook = layoutHook'
              , manageHook = manageHook'
              }
 
-- Hooks --
manageHook' :: ManageHook
manageHook' = (doF W.swapDown) <+> manageHook defaultConfig <+> manageDocks
 
logHook' :: Handle ->  X ()
-- logHook' h = dynamicLogWithPP $ customPP { ppOutput = hPutStrLn h }
logHook' h = dynamicLogWithPP $ customPP 
 
layoutHook' = customLayout
 
-- Looks --
-- bar
customPP :: PP
customPP = defaultPP { ppCurrent = xmobarColor "$AFAF87" "" . wrap "<" ">"
                     , ppTitle =  shorten 80
                     , ppSep =  " | "
                     , ppHiddenNoWindows = xmobarColor "$AFAF87" ""
                     , ppUrgent = xmobarColor "$FFFFAF" "" . wrap "[" "]"
                     }
 
-- borders
borderWidth' :: Dimension
borderWidth' = 1
 
normalBorderColor', focusedBorderColor' :: String
normalBorderColor'  = "$333333"
focusedBorderColor' = "$FF0000"
 
-- workspaces
workspaces' :: [WorkspaceId]
workspaces' = ["1-main", "2-SKYPE", "3-web", "4-icst", "5-rackspace", "6-dev", "7", "8", "9-mail"]
 
-- layouts
customLayout = avoidStruts $ smartBorders tiled ||| smartBorders (Mirror tiled)  ||| noBorders Full
  where
    tiled = ResizableTall 1 (2/100) (1/2) []
 
-- Terminal --
terminal' :: String
terminal' = "gnome-terminal"
 
-- Keys/Button bindings --
-- modmask
modMask' :: KeyMask
modMask' = mod4Mask
 
-- keys
keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
    -- launching and killing programs
    [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
    , ((modMask,               xK_p     ), spawn "exe=`dmenu_path | dmenu` &amp;&amp; eval \"exec $exe\"")
    , ((modMask .|. shiftMask, xK_p     ), spawn "gmrun")
    , ((modMask .|. shiftMask, xK_c     ), kill)
    , ((modMask .|. shiftMask, xK_m     ), spawn "claws-mail")
    , ((modMask .|. shiftMask, xK_e     ), spawn "emacs")
 
    -- layouts
    , ((modMask,               xK_space ), sendMessage NextLayout)
    , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    , ((modMask,               xK_b     ), sendMessage ToggleStruts)
 
    -- floating layer stuff
    , ((modMask,               xK_t     ), withFocused $ windows . W.sink)
 
    -- refresh
    , ((modMask,               xK_n     ), refresh)
 
    -- focus
    , ((modMask,               xK_Tab   ), windows W.focusDown)
    , ((modMask,               xK_j     ), windows W.focusDown)
    , ((modMask,               xK_k     ), windows W.focusUp)
    , ((modMask,               xK_m     ), windows W.focusMaster)
 
    -- swapping
    , ((modMask,		xK_Return), windows W.swapMaster)
    , ((modMask .|. shiftMask, xK_j     ), windows W.swapDown  )
    , ((modMask .|. shiftMask, xK_k     ), windows W.swapUp    )
 
    -- increase or decrease number of windows in the master area
    , ((modMask              , xK_comma ), sendMessage (IncMasterN 1))
    , ((modMask              , xK_period), sendMessage (IncMasterN (-1)))
 
    -- resizing
    , ((modMask,               xK_h     ), sendMessage Shrink)
    , ((modMask,               xK_l     ), sendMessage Expand)
    , ((modMask .|. shiftMask, xK_h     ), sendMessage MirrorShrink)
    , ((modMask .|. shiftMask, xK_l     ), sendMessage MirrorExpand)
 
    -- quit, or restart
    , ((modMask .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    , ((modMask              , xK_q     ), restart "xmonad" True)
    -- shutdown
    , ((modMask              , xK_F12    ), spawn "sudo halt")
    , ((modMask .|. controlMask, xK_F11   ), spawn "gnome-screensaver-command -l")
 
    ]
    ++
    -- mod-[1..9] %! Switch to workspace N
    -- mod-shift-[1..9] %! Move client to workspace N
    [((m .|. modMask, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]

as you can see I have a xmobar, here is my ~/.xmobarrc

desktop ~/ $
Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "grey"
       , position = Bottom
       , lowerOnStart = False
       , commands = [ Run Weather "LIPB" ["-t",": C","-L","18","-H","25","--normal","green","--high","red","--low","lightblue"] 36000
                    , Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
                    , Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10
                    , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
                    , Run Memory ["-t","Mem: %"] 54
                    , Run Swap [] 10
                    , Run Com "uname" ["-s","-r"] "" 36000
                    , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10
		    , Run Battery ["-t","Batt: ","-L","10","--low","red"] 10
		    , Run Com "uname" ["-s","-r"] "" 36000
		    , Run StdinReader
                    ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = "%cpu% | %memory% * %swap% | %eth0% - %wlan0% | %battery%} { %date% | %uname%"
       }

And finally a screenshot to have an idea.