Personal tools

Temp/Xmonad on Gnome

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Creation of page)
 
(Final version?)
 
Line 34: Line 34:
   
 
==Tips on configuring Xmonad==
 
==Tips on configuring Xmonad==
  +
  +
Allthe configuration is done in <tt>~/.xmonad/xmonad.hs</tt>.
  +
 
===Change the mod key===
 
===Change the mod key===
  +
  +
The default ''mod key'' is ''alt'', which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left ''logo key'':
  +
  +
<haskell>
  +
main = xmonad $ defaultConfig {
  +
modMask = mod4Mask
  +
}
  +
</haskell>
  +
 
===Make space for the panel===
 
===Make space for the panel===
  +
  +
There are two options for creating space for the Gnome panel; the builtin way using ''gaps'' and [http://hackage.haskell.org/packages/archive/xmonad-contrib/0.5/doc/html/XMonad-Hooks-ManageDocks.html ManageDocks].
  +
  +
For the former one can use the following:
  +
  +
<haskell>
  +
main = xmonad $ defaultConfig {
  +
defaultGaps = [(24,24,0,0)]
  +
}
  +
</haskell>
  +
  +
For the latter:
  +
  +
<haskell>
  +
import XMonad.Hooks.ManageDocks
  +
main = xmonad defaultConfig {
  +
manageHook = manageDocks
  +
, layoutHook = avoidStruts (tall ||| mirror tall ||| Full)
  +
}
  +
where tall = Tall 1 (3/100) (1/2)
  +
</haskell>
  +
 
===Extended Window Manager Hints===
 
===Extended Window Manager Hints===
  +
  +
[http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html EwmhDesktop] makes it possible to let Gnome know about Xmonad windows and workspaces:
  +
  +
<haskell>
  +
import XMonad.Hooks.EwmhDesktops
  +
main = xmonad $ defaultConfig {
  +
logHook = ewmhDesktopsLogHook
  +
}
  +
</haskell>
  +
 
===A complete example configuration===
 
===A complete example configuration===
  +
  +
Here is a very simple configuration suitable for a desktop with two panels, one at the top and one at the bottom:
  +
  +
<haskell>
  +
import XMonad
  +
import XMonad.Hooks.EwmhDesktops
  +
  +
-- left alt is used in GTK so use left logo instead
  +
myModMask = mod4Mask
  +
  +
-- let Gnome know about Xmonad actions
  +
myLogHook = ewmhDesktopsLogHook
  +
  +
main = xmonad $ defaultConfig {
  +
defaultGaps = [(24,24,0,0)],
  +
logHook = myLogHook,
  +
modMask = myModMask
  +
}
  +
</haskell>

Latest revision as of 21:07, 15 March 2008

Contents

[edit] 1 Introduction

Xmonad makes an excellent drop-in replacement for Gnome's default window manager (metacity) giving you a slick tiling window manager. This guide will help you set up Gnome to use Xmonad 0.6.

This is an update to the previous page on Xmonad/Using xmonad in Gnome. Which in turn was an update to the original page on the subject.

[edit] 2 Setting up Gnome to use Xmonad

The easiest way is to let Gnome start Xmonad itself by modifying ~/.gnomerc to contain

   export WINDOW_MANAGER=/usr/bin/xmonad

[edit] 3 Tweak Gnome to work better with Xmonad

These are a few steps that greatly improves the experience of running Xmonad under Gnome. Note that on some systems the binary gconftool is called gconftool-2.

[edit] 3.1 Disable the Nautilus desktop

From the command line execute:

       gconftool --type boolean --set /apps/nautilus/preferences/show_desktop false

[edit] 3.2 Changing desktop background

If you need to change the workspace background programmatically (i.e. from some extension setting in xmonad's configuration file), you can use the command:

   gconftool --type string --set /desktop/gnome/background/picture_filename "/path/to/your/image.png"

[edit] 3.3 Fixing the pointer

After switching to Xmonad you might notice that the default pointer isn't the one you chose in your beautiful Gnome theme. The way to address this is to run xsetroot during session startup. Open the session configuration dialogue (System -> Preferences -> Sessions). Add a new startup program, choose any name and comment you want but make the command

   /usr/bin/xsetroot -cursor_name left_ptr

[edit] 4 Tips on configuring Xmonad

Allthe configuration is done in ~/.xmonad/xmonad.hs.

[edit] 4.1 Change the mod key

The default mod key is alt, which conflicts with Gnome keybindings. In order to use be able to use the keyboard to e.g. getting rid of dialogues we rebind it to the left logo key:

main = xmonad $ defaultConfig {
        modMask = mod4Mask
    }

[edit] 4.2 Make space for the panel

There are two options for creating space for the Gnome panel; the builtin way using gaps and ManageDocks.

For the former one can use the following:

main = xmonad $ defaultConfig {
        defaultGaps = [(24,24,0,0)]
    }

For the latter:

import XMonad.Hooks.ManageDocks
main = xmonad defaultConfig {
        manageHook = manageDocks
        , layoutHook = avoidStruts (tall ||| mirror tall ||| Full)
    }
    where tall = Tall 1 (3/100) (1/2)

[edit] 4.3 Extended Window Manager Hints

EwmhDesktop makes it possible to let Gnome know about Xmonad windows and workspaces:

import XMonad.Hooks.EwmhDesktops
main = xmonad $ defaultConfig {
        logHook = ewmhDesktopsLogHook
    }

[edit] 4.4 A complete example configuration

Here is a very simple configuration suitable for a desktop with two panels, one at the top and one at the bottom:

import XMonad
import XMonad.Hooks.EwmhDesktops
 
-- left alt is used in GTK so use left logo instead
myModMask = mod4Mask
 
-- let Gnome know about Xmonad actions
myLogHook = ewmhDesktopsLogHook
 
main = xmonad $ defaultConfig {
        defaultGaps = [(24,24,0,0)],
        logHook = myLogHook,
        modMask = myModMask
    }