From 9c46e8b7fa3fa935704efc08f5505e695f5d83c6 Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Thu, 8 Mar 2007 05:36:14 +0100 Subject: Make the number of workspaces configurable. darcs-hash:20070308043614-a5988-47cf3ddfda29dbe436509247e12b7fdf0e64c7ac --- Main.hs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'Main.hs') diff --git a/Main.hs b/Main.hs index f34cd72..024e869 100644 --- a/Main.hs +++ b/Main.hs @@ -30,11 +30,17 @@ 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 -- cgit v1.2.3