aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions
diff options
context:
space:
mode:
authorMarco TĂșlio Gontijo e Silva <marcot@riseup.net>2008-07-14 17:36:01 +0200
committerMarco TĂșlio Gontijo e Silva <marcot@riseup.net>2008-07-14 17:36:01 +0200
commitb7018a531333501e4b55dcb520e95ccf5eae6488 (patch)
treea40b57e573fb227f4922e3e485668d8ebcdd9bb7 /XMonad/Actions
parent85f5a7c0bbd676f399f56629bcba9b0e543d2751 (diff)
downloadXMonadContrib-b7018a531333501e4b55dcb520e95ccf5eae6488.tar.gz
XMonadContrib-b7018a531333501e4b55dcb520e95ccf5eae6488.tar.xz
XMonadContrib-b7018a531333501e4b55dcb520e95ccf5eae6488.zip
XMonad.Actions.Plane.planeKeys: function to make easier to configure
darcs-hash:20080714153601-7641b-fbd2b698009214ed740dbf3160188aa71e2e7940.gz
Diffstat (limited to 'XMonad/Actions')
-rw-r--r--XMonad/Actions/Plane.hs23
1 files changed, 17 insertions, 6 deletions
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.