summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-03-08 05:36:14 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-03-08 05:36:14 +0100
commit9c46e8b7fa3fa935704efc08f5505e695f5d83c6 (patch)
tree716afe650a0a44342630dd16336192a56e3027cb
parent89f461234505bd9082dd60e766bc7e4c7b913f01 (diff)
downloadmetatile-9c46e8b7fa3fa935704efc08f5505e695f5d83c6.tar
metatile-9c46e8b7fa3fa935704efc08f5505e695f5d83c6.zip
Make the number of workspaces configurable.
darcs-hash:20070308043614-a5988-47cf3ddfda29dbe436509247e12b7fdf0e64c7ac
-rw-r--r--Main.hs28
1 files changed, 13 insertions, 15 deletions
diff --git a/Main.hs b/Main.hs
index f34cd72..024e869 100644
--- a/Main.hs
+++ b/Main.hs
@@ -31,10 +31,16 @@ import Control.Monad.State
import W
--
+-- The number of workspaces:
+--
+workspaces :: Int
+workspaces = 5
+
+--
-- The keys list
--
keys :: M.Map (KeyMask, KeySym) (W ())
-keys = M.fromList
+keys = M.fromList $
[ ((mod1Mask .|. shiftMask, xK_Return), spawn "xterm")
, ((mod1Mask, xK_p ), spawn "exe=`dmenu_path | dmenu` && exec $exe")
, ((controlMask, xK_space ), spawn "gmrun")
@@ -43,20 +49,12 @@ keys = M.fromList
, ((mod1Mask, xK_k ), focus (-1))
, ((mod1Mask .|. shiftMask, xK_c ), kill)
, ((mod1Mask .|. shiftMask, xK_q ), io $ exitWith ExitSuccess)
+ ] ++
+ -- generate keybindings for each workspace:
+ [((m .|. mod1Mask, xK_0 + fromIntegral i), f i)
+ | i <- [1 .. workspaces]
+ , (f, m) <- [(view, 0), (tag, shiftMask)]]
- , ((mod1Mask, xK_1 ), view 1)
- , ((mod1Mask, xK_2 ), view 2)
- , ((mod1Mask, xK_3 ), view 3)
- , ((mod1Mask, xK_4 ), view 4)
- , ((mod1Mask, xK_5 ), view 5)
-
- , ((mod1Mask .|. shiftMask, xK_1 ), tag 1)
- , ((mod1Mask .|. shiftMask, xK_2 ), tag 2)
- , ((mod1Mask .|. shiftMask, xK_3 ), tag 3)
- , ((mod1Mask .|. shiftMask, xK_4 ), tag 4)
- , ((mod1Mask .|. shiftMask, xK_5 ), tag 5)
-
- ]
--
-- let's get underway
@@ -69,7 +67,7 @@ main = do
{ display = dpy
, screenWidth = displayWidth dpy dflt
, screenHeight = displayHeight dpy dflt
- , workspace = (0,S.fromList (replicate 5 [])) -- 5 empty workspaces
+ , workspace = (0,S.fromList (replicate workspaces [])) -- empty workspaces
}
runW initState $ do