X.A.WindowNavigation: add withWindowNavigation, for easy setup

This should be more flexible than it is -- I've got an idea, but am interested to hear others.
This commit is contained in:
Devin Mullins 2008-05-11 22:04:58 +00:00
parent 98c70dd264
commit 8f0b9fa066

View File

@ -18,6 +18,7 @@
module XMonad.Actions.WindowNavigation ( module XMonad.Actions.WindowNavigation (
-- * Usage -- * Usage
-- $usage -- $usage
withWindowNavigation,
go, swap, go, swap,
Direction(..) Direction(..)
) where ) where
@ -39,7 +40,6 @@ import Graphics.X11.Xlib
-- Don't use it! What, are you crazy? -- Don't use it! What, are you crazy?
-- TODO: -- TODO:
-- - withWindowNavigation :: XConfig l -> XConfig l
-- - cleanup -- - cleanup
-- - actually deal with multiple screens -- - actually deal with multiple screens
-- - documentation :) -- - documentation :)
@ -47,6 +47,15 @@ import Graphics.X11.Xlib
-- - solve the 2+3, middle right to bottom left problem -- - solve the 2+3, middle right to bottom left problem
-- - manageHook to draw window decos? -- - manageHook to draw window decos?
withWindowNavigation :: (KeySym, KeySym, KeySym, KeySym) -> XConfig l -> IO (XConfig l)
withWindowNavigation (u,l,d,r) conf = do
posRef <- newIORef M.empty
return conf { keys = \cnf -> M.fromList [
((modMask cnf, u), go posRef U),
((modMask cnf, l), go posRef L),
((modMask cnf, d), go posRef D),
((modMask cnf, r), go posRef R)
] `M.union` (keys conf cnf) }
type WNState = Map WorkspaceId Point type WNState = Map WorkspaceId Point