Extending: updated to the lates config changes - manageHook simplification

This commit is contained in:
Andrea Rossato
2007-12-09 16:47:31 +00:00
parent 71d1c8c23b
commit 88424dc1a8

View File

@@ -710,24 +710,42 @@ to the default actions.
Let's start by analyzing the default 'XMonad.Config.manageHook', defined Let's start by analyzing the default 'XMonad.Config.manageHook', defined
in "XMonad.Config": in "XMonad.Config":
> manageHook :: ManageHook > manageHook :: ManageHook
> manageHook = composeAll . concat $ > manageHook = composeAll
> [ [ className =? c --> doFloat | c <- floats] > [ className =? "MPlayer" --> doFloat
> , [ resource =? r --> doIgnore | r <- ignore] > , className =? "Gimp" --> doFloat
> , [ resource =? "Gecko" --> doF (W.shift "web") ]] > , resource =? "desktop_window" --> doIgnore
> where floats = ["MPlayer", "Gimp"] > , resource =? "kdesktop" --> doIgnore ]
> ignore = ["gnome-panel", "desktop_window", "kicker", "kdesktop"]
'XMonad.ManageHook.composeAll' can be used to compose a list of 'XMonad.ManageHook.composeAll' can be used to compose a list of
different 'XMonad.Config.ManageHook's. In this example we have three different 'XMonad.Config.ManageHook's. In this example we have a list
lists of 'XMonad.Config.ManageHook's: the first one is the list of the of 'XMonad.Config.ManageHook's formed by the following commands: the
windows to be placed in the float layer with the Mplayer's and the Gimp's windows, whose 'XMonad.ManageHook.className'
'XMonad.ManageHook.doFloat' function (MPlayer and Gimp); the second are, respectively \"Mplayer\" and \"Gimp\", are to be placed in the
one is the list of windows to be ignored; the third (which contains float layer with the 'XMonad.ManageHook.doFloat' function; the windows
only one 'XMonad.Config.ManageHook') will match firefox, or mozilla, whose resource names are respectively \"desktop_window\" and
and put them in the workspace named \"web\", with \kdesktop\" are to be ignored with the 'XMonad.ManageHook.doIgnore'
'XMonad.ManageHook.doF' and 'XMonad.StackSet.shift'. (@concat@ simply function.
combines these three lists into a single list.)
This is another example of 'XMonad.Config.manageHook', taken from
"XMonad.Config.Arossato":
> myManageHook = composeAll [ resource =? "realplay.bin" --> doFloat
> , resource =? "win" --> doF (W.shift "doc") -- xpdf
> , resource =? "firefox-bin" --> doF (W.shift "web")
> ]
> newManageHook = myManageHook <+> manageHook defaultConfig
Again we use 'XMonad.ManageHook.composeAll' to compose a list of
different 'XMonad.Config.ManageHook's. The first one will put
RealPlayer on the float layer, the second one will put the xpdf
windows in the workspace named \"doc\", with 'XMonad.ManageHook.doF'
and 'XMonad.StackSet.shift' functions, and the third one will put all
firefox windows on the workspace called "web". Then we use the
'XMonad.ManageHook.<+>' combinator to compose @myManageHook@ with the
default 'XMonad.Config.manageHook' to form @newManageHook@.
Each 'XMonad.Config.ManageHook' has the form: Each 'XMonad.Config.ManageHook' has the form: