summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-03-21 04:38:07 +0100
committerJason Creighton <jcreigh@gmail.com>2007-03-21 04:38:07 +0100
commit7f5dc0748300e07101fc306ec6b447a35e878f54 (patch)
tree5de1d08bb17923780b23081dbe13c22173160e90 /Main.hs
parent006e62b46b3d1026c6048d0a0ccc3bab5abb3465 (diff)
downloadmetatile-7f5dc0748300e07101fc306ec6b447a35e878f54.tar
metatile-7f5dc0748300e07101fc306ec6b447a35e878f54.zip
add keybindings to change screens and tag windows to screens
darcs-hash:20070321033807-b9aa7-182a8a380ff559eb2ab3af0ec143712b38cdcb60
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
index 941067c..9e52c77 100644
--- a/Main.hs
+++ b/Main.hs
@@ -61,6 +61,12 @@ keys = M.fromList $
[((m .|. modMask, xK_0 + fromIntegral i), f i)
| i <- [1 .. workspaces]
, (f, m) <- [(view, 0), (tag, shiftMask)]]
+ -- generate keybindings to each screen:
+ ++
+ [((m .|. modMask, key), screenWS sc >>= f)
+ | (key, sc) <- zip [xK_w, xK_e, xK_r] [1..]
+ , (f, m) <- [(view, 0), (tag, shiftMask)]]
+
--
-- The mask for the numlock key. You may need to change this on some systems.
@@ -385,3 +391,12 @@ view o = do
-- | True if window is under management by us
isClient :: Window -> X Bool
isClient w = liftM (W.member w) (gets workspace)
+
+-- | screenWS. Returns the workspace currently visible on screen n
+screenWS :: Int -> X Int
+screenWS n = do
+ ws2sc <- gets wsOnScreen
+ -- FIXME: It's ugly to have to query this way. We need a different way to
+ -- keep track of screen <-> workspace mappings.
+ let ws = fmap fst $ find (\(_, scn) -> scn == (n-1)) (M.assocs ws2sc)
+ return $ (fromMaybe 0 ws) + 1