Difference between revisions of "Xmonad/Basic Desktop Environment Integration"

From HaskellWiki
Jump to navigation Jump to search
(→‎Using Desktop Environment Config Modules: add link to and examples from C.Desktop documentation)
Line 18: Line 18:
   
 
== Basic desktop config examples ==
 
== 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.)
+
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>
 
<haskell>
 
import XMonad
 
import XMonad

Revision as of 09:01, 22 October 2009

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.

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

Customizing desktop environment configs

(once xmonad-0.9 is released) 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:

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.

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