summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Config.hs11
-rw-r--r--Main.hs2
-rw-r--r--Operations.hs15
-rw-r--r--XMonad.hs2
4 files changed, 19 insertions, 11 deletions
diff --git a/Config.hs b/Config.hs
index 8d0f4f7..45a8f9e 100644
--- a/Config.hs
+++ b/Config.hs
@@ -49,14 +49,14 @@ defaultDelta = 3%100
defaultWindowsInMaster :: Int
defaultWindowsInMaster = 1
--- Default offset of drawable screen boundary from physical screen.
+-- Default offset of drawable screen boundaries from each physical screen.
-- Anything non-zero here will leave a gap of that many pixels on the
--- given edge. A useful gap at top of screen for a menu bar (e.g. 15)
+-- given edge, on the that screen. A useful gap at top of screen for a menu bar (e.g. 15)
--
-- Fields are: top, bottom, left, right.
--
-defaultGap :: (Int,Int,Int,Int)
-defaultGap = (0,0,0,0) -- 15 for default dzen
+defaultGaps :: [(Int,Int,Int,Int)]
+defaultGaps = [(0,0,0,0)] -- 15 for default dzen
-- numlock handling:
--
@@ -120,7 +120,8 @@ keys = M.fromList $
, ((modMask , xK_period), sendMessage (IncMasterN (-1))) -- @@ Deincrement the number of windows in the master area
-- toggle the status bar gap
- , ((modMask , xK_b ), modifyGap (\n -> if n == defaultGap then (0,0,0,0) else defaultGap)) -- @@ Toggle the status bar gap
+ , ((modMask , xK_b ),
+ modifyGap (\i n -> let x = defaultGaps !! i in if n == x then (0,0,0,0) else x)) -- @@ Toggle the status bar gap
-- quit, or restart
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) -- @@ Quit xmonad
diff --git a/Main.hs b/Main.hs
index 106db0d..3969321 100644
--- a/Main.hs
+++ b/Main.hs
@@ -61,7 +61,7 @@ main = do
st = XState
{ windowset = winset
, layouts = M.fromList [(w, safeLayouts) | w <- [0 .. W workspaces - 1]]
- , statusGap = defaultGap
+ , statusGaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0)
, xineScreens = xinesc
, dimensions = (fromIntegral (displayWidth dpy dflt),
fromIntegral (displayHeight dpy dflt)) }
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
diff --git a/XMonad.hs b/XMonad.hs
index 839b1dd..2f1577c 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -40,7 +40,7 @@ data XState = XState
{ windowset :: !WindowSet -- ^ workspace list
, xineScreens :: ![Rectangle] -- ^ dimensions of each screen
, dimensions :: !(Position,Position) -- ^ dimensions of the screen,
- , statusGap :: !(Int,Int,Int,Int) -- ^ width of status bar
+ , statusGaps :: ![(Int,Int,Int,Int)] -- ^ width of status bar on each screen
, layouts :: !(M.Map WorkspaceId (Layout, [Layout])) }
-- ^ mapping of workspaces to descriptions of their layouts