summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-05-28 05:15:01 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-05-28 05:15:01 +0200
commitc60ea349b9b5e9942e3e396fc78a2d4716226f70 (patch)
tree32f29df936cef95ab57b01f4a72c4310d759ed23 /Operations.hs
parent631435da5f7a4986180b3224fa7391bbb020193a (diff)
downloadmetatile-c60ea349b9b5e9942e3e396fc78a2d4716226f70.tar
metatile-c60ea349b9b5e9942e3e396fc78a2d4716226f70.zip
support per-screen gap settings. you can have different gaps on individual screens now
darcs-hash:20070528031501-9c5c1-beaadbacb5efc1ce5998aba41fbb3b2c68cdf0d1
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/Operations.hs b/Operations.hs
index 56e15d9..ed2ff9d 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -67,9 +67,15 @@ shift n = withFocused hide >> windows (W.shift n)
view :: WorkspaceId -> X ()
view = windows . W.view
--- | Modify the size of the status gap at the top of the screen
-modifyGap :: ((Int,Int,Int,Int) -> (Int,Int,Int,Int)) -> X ()
-modifyGap f = modify (\s -> s { statusGap = f (statusGap s) }) >> refresh
+-- | Modify the size of the status gap at the top of the current screen
+-- Taking a function giving the current screen, and current geometry.
+modifyGap :: (Int -> (Int,Int,Int,Int) -> (Int,Int,Int,Int)) -> X ()
+modifyGap f = do
+ XState { windowset = ws, statusGaps = gaps } <- get
+ let n = fromIntegral $ W.screen (W.current ws)
+ (a,i:b) = splitAt n gaps
+ modify $ \s -> s { statusGaps = a ++ f n i : b }
+ refresh
-- | Kill the currently focused client. If we do kill it, we'll get a
-- delete notify back from X.
@@ -127,7 +133,7 @@ hide w = withDisplay $ \d -> do
--
refresh :: X ()
refresh = do
- XState { windowset = ws, layouts = fls, xineScreens = xinesc, statusGap = (gt,gb,gl,gr) } <- get
+ XState { windowset = ws, layouts = fls, xineScreens = xinesc, statusGaps = gaps } <- get
d <- asks display
-- for each workspace, layout the currently visible workspaces
@@ -136,6 +142,7 @@ refresh = do
this = W.view n ws
Just l = fmap fst $ M.lookup n fls
r@(Rectangle sx sy sw sh) = genericIndex xinesc (W.screen w)
+ (gt,gb,gl,gr) = genericIndex gaps (W.screen w)
-- now tile the windows on this workspace, and set gap maybe on current
rs <- doLayout l (if w == W.current ws