Personal tools

Xmonad/Basic Desktop Environment Integration

From HaskellWiki

< Xmonad(Difference between revisions)
Jump to: navigation, search
m (Edited for clarity)
m (Customizing desktop environment configs)
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
 
= Using Desktop Environment Config Modules =
 
= Using Desktop Environment Config Modules =
   
The following modules from xmonad-contrib make it easy to start with good basic defaults to work within the given desktop environment. Make sure both the xmonad and xmonad-contrib packages are installed and of the same version. These modules set up better communication between xmonad and taskbars or status bars through extended window manager hints (EWMH's), bind the default key for gap toggling, and rebind run and logout keys to sensible desktop environment defaults.
+
The following modules from xmonad-contrib make it easy to start with
  +
good basic defaults to work within the given desktop environment (DE).
  +
Make sure both the xmonad and xmonad-contrib packages are installed and
  +
of the same version, then import the appropriate Config module and begin
  +
with one of the example configs below.
   
You will still need to set up your session management and tell your desktop environment (DE) to use xmonad as described in the DE specific documents on [[Xmonad]], but the following will take care of getting xmonad's part of the puzzle working with a useful default configuration.
+
The desktop configs enable communication between xmonad and pagers, taskbars,
  +
status bars, tray apps, etc. through extended window manager hints (EWMH's).
  +
They also set a prettier root window mouse cursor, bind the default key for
  +
gap toggling, and rebind run and logout keys to sensible desktop environment
  +
defaults.
   
Once your desktop environment is ready to use xmonad, placing the appropriate version below in <code>~/.xmonad/xmonad.hs</code> will ensure xmonad is ready to work with the DE.
+
You will still need to set up your session management and tell your DE to use xmonad as described in the DE specific documents on [[Xmonad]], but the following will take care of getting xmonad's part of the puzzle working with a useful default configuration.
   
XMonad.Config.Xfce
+
Once your DE is ready to use xmonad, placing the appropriate version below in <code>~/.xmonad/xmonad.hs</code> will ensure xmonad is ready to work with the DE.
  +
  +
== Basic desktop config examples ==
  +
The core functionality used by all the specific DE configs. (Useful if you just want support for a few specific EWMH apps, or are running something other than KDE, Gnome, or xfce.)
  +
<haskell>
  +
import XMonad
  +
import XMonad.Config.Desktop
  +
  +
main = xmonad desktopConfig
  +
</haskell>
  +
  +
An xmonad.hs for xfce
 
<haskell>
 
<haskell>
 
import XMonad
 
import XMonad
Line 15: Line 15:
 
</haskell>
 
</haskell>
   
XMonad.Config.Gnome
+
An xmonad.hs for Gnome
 
<haskell>
 
<haskell>
 
import XMonad
 
import XMonad
Line 23: Line 23:
 
</haskell>
 
</haskell>
   
XMonad.Config.Kde
+
An xmonad.hs for KDE
 
<haskell>
 
<haskell>
 
import XMonad
 
import XMonad
Line 29: Line 29:
   
 
main = xmonad kdeConfig
 
main = xmonad kdeConfig
  +
-- or for kde 4 (> xmonad-0.8*, darcs xmonad)
  +
-- xmonad kde4Config
  +
</haskell>
  +
  +
== Customizing desktop environment configs ==
  +
  +
See the documentation for the [http://www.xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Config-Desktop.html XMonad.Config.Desktop] module for more details on customizing the desktop configs. However, here are examples of the most common customizations:
  +
  +
===Modifying layouts, manageHook, or key bindings===
  +
  +
See also [http://www.xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Util-EZConfig.html Util.EZConfig] for more options for modifying key bindings. To add to layouts, manageHook or key bindings use something like the following to combine your modifications with the desktop config settings:
  +
  +
<haskell>
  +
import XMonad
  +
import XMonad.Config.Desktop
  +
import XMonad.Layout.Tabbed
  +
import XMonad.Util.EZConfig (additionalKeys)
  +
  +
main =
  +
xmonad $ desktopConfig {
  +
-- add manage hooks while still ignoring panels and using default manageHooks
  +
manageHook = myManageHook <+> manageHook desktopConfig
  +
  +
-- add a fullscreen tabbed layout that does not avoid covering
  +
-- up desktop panels before the desktop layouts
  +
, layoutHook = simpleTabbed ||| layoutHook desktopConfig
  +
}
  +
-- add a screenshot key to the default desktop bindings
  +
`additionalKeys` [ ((mod4Mask, xK_F8), spawn "scrot") ]
  +
</haskell>
  +
  +
To replace the desktop layouts with your own choices, but still allow toggling panel visibility, use desktopLayoutModifiers to modify your layouts:
  +
  +
<haskell>
  +
, layoutHook = desktopLayoutModifiers $ simpleTabbed ||| Tall 1 0.03 0.5
  +
</haskell>
  +
  +
<hask>desktopLayoutModifiers</hask> modifies a layout to avoid covering docks, panels, etc. that set the _NET_WM_STRUT_PARTIAL property. See also XMonad.Hooks.ManageDocks.
  +
  +
===Modifying the logHook===
  +
  +
To add to the logHook while still sending workspace and window information to DE apps use something like:
  +
  +
<haskell>
  +
, logHook = myLogHook >> logHook desktopConfig
  +
</haskell>
  +
  +
Or for more elaborate logHooks you can use do:
  +
  +
<haskell>
  +
, logHook = do
  +
dynamicLogWithPP xmobarPP
  +
updatePointer (Relative 0.9 0.9)
  +
logHook desktopConfig
 
</haskell>
 
</haskell>

Revision as of 10:18, 1 January 2011

Contents

1 Using Desktop Environment Config Modules

The following modules from xmonad-contrib make it easy to start with good basic defaults to work within the given desktop environment (DE). Make sure both the xmonad and xmonad-contrib packages are installed and of the same version, then import the appropriate Config module and begin with one of the example configs below.

The desktop configs enable communication between xmonad and pagers, taskbars, status bars, tray apps, etc. through extended window manager hints (EWMH's). They also set a prettier root window mouse cursor, bind the default key for gap toggling, and rebind run and logout keys to sensible desktop environment defaults.

You will still need to set up your session management and tell your DE to use xmonad as described in the DE specific documents on Xmonad, but the following will take care of getting xmonad's part of the puzzle working with a useful default configuration.

Once your DE is ready to use xmonad, placing the appropriate version below in ~/.xmonad/xmonad.hs will ensure xmonad is ready to work with the DE.

1.1 Basic desktop config examples

The core functionality used by all the specific DE configs. (Useful if you just want support for a few specific EWMH apps, or are running something other than KDE, Gnome, or xfce.)

import XMonad
import XMonad.Config.Desktop
 
main = xmonad desktopConfig

An xmonad.hs for xfce

import XMonad
import XMonad.Config.Xfce
 
main = xmonad xfceConfig

An xmonad.hs for Gnome

import XMonad
import XMonad.Config.Gnome
 
main = xmonad gnomeConfig

An xmonad.hs for KDE

import XMonad
import XMonad.Config.Kde
 
main = xmonad kdeConfig
    -- or for kde 4 (> xmonad-0.8*, darcs xmonad)
    -- xmonad kde4Config

1.2 Customizing desktop environment configs

See the documentation for the XMonad.Config.Desktop module for more details on customizing the desktop configs. However, here are examples of the most common customizations:

1.2.1 Modifying layouts, manageHook, or key bindings

See also Util.EZConfig for more options for modifying key bindings. To add to layouts, manageHook or key bindings use something like the following to combine your modifications with the desktop config settings:

 import XMonad
 import XMonad.Config.Desktop
 import XMonad.Layout.Tabbed
 import XMonad.Util.EZConfig (additionalKeys)
 
 main =
   xmonad $ desktopConfig {
     -- add manage hooks while still ignoring panels and using default manageHooks
       manageHook = myManageHook <+> manageHook desktopConfig
 
     -- add a fullscreen tabbed layout that does not avoid covering
     -- up desktop panels before the desktop layouts
     , layoutHook = simpleTabbed ||| layoutHook desktopConfig
     }
     -- add a screenshot key to the default desktop bindings
     `additionalKeys` [ ((mod4Mask, xK_F8), spawn "scrot") ]

To replace the desktop layouts with your own choices, but still allow toggling panel visibility, use desktopLayoutModifiers to modify your layouts:

  , layoutHook = desktopLayoutModifiers $ simpleTabbed ||| Tall 1 0.03 0.5
desktopLayoutModifiers
modifies a layout to avoid covering docks, panels, etc. that set the _NET_WM_STRUT_PARTIAL property. See also XMonad.Hooks.ManageDocks.

1.2.2 Modifying the logHook

To add to the logHook while still sending workspace and window information to DE apps use something like:

  , logHook = myLogHook >> logHook desktopConfig

Or for more elaborate logHooks you can use do:

  , logHook = do
        dynamicLogWithPP xmobarPP
        updatePointer (Relative 0.9 0.9)
        logHook desktopConfig