From b7018a531333501e4b55dcb520e95ccf5eae6488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20T=C3=BAlio=20Gontijo=20e=20Silva?= Date: Mon, 14 Jul 2008 17:36:01 +0200 Subject: XMonad.Actions.Plane.planeKeys: function to make easier to configure darcs-hash:20080714153601-7641b-fbd2b698009214ed740dbf3160188aa71e2e7940.gz --- XMonad/Actions/Plane.hs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'XMonad/Actions/Plane.hs') diff --git a/XMonad/Actions/Plane.hs b/XMonad/Actions/Plane.hs index f9391e4..c99ed74 100644 --- a/XMonad/Actions/Plane.hs +++ b/XMonad/Actions/Plane.hs @@ -29,6 +29,9 @@ module XMonad.Actions.Plane , Limits (..) , Lines (..) + -- * Key bindings + , planeKeys + -- * Navigating through workspaces , planeShift , planeMove @@ -37,6 +40,7 @@ module XMonad.Actions.Plane import Control.Monad import Data.List +import Data.Map hiding (split) import Data.Maybe import XMonad @@ -52,12 +56,7 @@ import XMonad.Util.Run -- > -- > myKeys conf = union (keys defaultConfig conf) $ myNewKeys conf -- > --- > myNewkeys (XConfig {modMask = m}) = --- > fromList --- > [ ((keyMask .|. m, keySym), function (Lines 3) Finite direction) --- > | (keySym, direction) <- zip [xK_Left .. xK_Down] $ enumFrom ToLeft --- > , (keyMask, function) <- [(0, planeMove), (shiftMask, planeShift)] --- > ] +-- > myNewkeys (XConfig {modMask = modm}) = planeKeys modm (Lines 3) Finite -- -- For detailed instructions on editing your key bindings, see -- "XMonad.Doc.Extending#Editing_key_bindings". @@ -81,6 +80,18 @@ data Lines = GConf -- ^ Use @gconftool-2@ to find out the number of lines. | Lines Int -- ^ Specify the number of lines explicity. +-- | This is the way most people would like to use this module. It ataches the +-- 'KeyMask' passed as a parameter with 'xK_Left', 'xK_Up', 'xK_Right' and +-- 'xK_Down', associating it with 'planeMove' to the corresponding 'Direction'. +-- It also associates these bindings with 'shiftMask' to 'planeShift'. +planeKeys :: KeyMask -> Lines -> Limits -> Map (KeyMask, KeySym) (X ()) +planeKeys modm ln limits = + fromList $ + [ ((keyMask, keySym), function ln limits direction) + | (keySym, direction) <- zip [xK_Left .. xK_Down] $ enumFrom ToLeft + , (keyMask, function) <- [(modm, planeMove), (shiftMask .|. modm, planeShift)] + ] + -- | Shift a window to the next workspace in 'Direction'. Note that this will -- also move to the next workspace. It's a good idea to use the same 'Lines' -- and 'Limits' for all the bindings. -- cgit v1.2.3