aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-11-09 04:18:10 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-11-09 04:18:10 +0100
commit2fda3e8b4fcd2398aade1b83b0c59df44663f46a (patch)
tree7beeabf19474e36dee2d8223dbdf9c4f25ceba70 /XMonad
parent4ac83b98a1abf352c27cdd4caefaf4dc86ef59e4 (diff)
downloadxmonad-2fda3e8b4fcd2398aade1b83b0c59df44663f46a.tar.gz
xmonad-2fda3e8b4fcd2398aade1b83b0c59df44663f46a.tar.xz
xmonad-2fda3e8b4fcd2398aade1b83b0c59df44663f46a.zip
Docs for ManageHook
darcs-hash:20071109031810-a5988-04d650e53e838af288c8d4579f433ec60fad6971.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/ManageHook.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/XMonad/ManageHook.hs b/XMonad/ManageHook.hs
index c6bbc8c..a1991f1 100644
--- a/XMonad/ManageHook.hs
+++ b/XMonad/ManageHook.hs
@@ -25,31 +25,40 @@ import XMonad.Operations (floatLocation, reveal)
type ManageHook = Query (WindowSet -> WindowSet)
type Query a = Window -> X a
+-- | The identity hook that returns the WindowSet unchanged.
idHook :: ManageHook
idHook = doF id
+-- | Compose two 'ManageHook's
(<+>) :: ManageHook -> ManageHook -> ManageHook
f <+> g = \w -> liftM2 (.) (f w) (g w)
+-- | Compose the list of 'ManageHook's
composeAll :: [ManageHook] -> ManageHook
composeAll = foldr (<+>) idHook
+-- | 'p --> x'. If 'p' returns 'True', execute the 'ManageHook'.
(-->) :: Query Bool -> ManageHook -> ManageHook
p --> f = \w -> p w >>= \b -> if b then f w else idHook w
+-- | 'q =? x'. if the result of 'q' equals 'x', return 'True'.
(=?) :: Eq a => Query a -> a -> Query Bool
q =? x = \w -> fmap (== x) (q w)
+-- | Queries that return the window title, resource, or class.
title, resource, className :: Query String
title = \w -> withDisplay $ \d -> fmap (fromMaybe "") $ io $ fetchName d w
resource = \w -> withDisplay $ \d -> fmap resName $ io $ getClassHint d w
className = \w -> withDisplay $ \d -> fmap resClass $ io $ getClassHint d w
+-- | Modify the 'WindowSet' with a pure function.
+doF :: (WindowSet -> WindowSet) -> ManageHook
+doF f = const (return f)
+
+-- | Move the window to the floating layer.
doFloat :: ManageHook
doFloat = \w -> fmap (W.float w . snd) (floatLocation w)
+-- | Map the window and remove it from the 'WindowSet'.
doIgnore :: ManageHook
doIgnore = \w -> reveal w >> return (W.delete w)
-
-doF :: (WindowSet -> WindowSet) -> ManageHook
-doF f = const (return f)