diff options
author | Tomas Janousek <tomi@nomi.cz> | 2009-11-19 15:50:43 +0100 |
---|---|---|
committer | Tomas Janousek <tomi@nomi.cz> | 2009-11-19 15:50:43 +0100 |
commit | db45f58694d887ff8fcb1a3ef5c5b1f821dd08cd (patch) | |
tree | 2b0b4f94a8a41556efc595a4e5da95cc6b817b49 | |
parent | 0aaeb686f913cd51fc812551016bbd49e6c64822 (diff) | |
download | XMonadContrib-db45f58694d887ff8fcb1a3ef5c5b1f821dd08cd.tar.gz XMonadContrib-db45f58694d887ff8fcb1a3ef5c5b1f821dd08cd.tar.xz XMonadContrib-db45f58694d887ff8fcb1a3ef5c5b1f821dd08cd.zip |
X.H.ManageDocks: ignore struts that cover an entire screen on that screen
Ignore-this: ad7bbf10c49c9f3e938cdc3d8588e202
Imagine a screen layout like this:
11111111
11111111
11111111
222222 <--- xmobar here
222222
222222
When placing xmobar as indicated, the partial strut property indicates that an
entire height of screen 1 is covered by the strut, as well as a few lines at
the top of screen 2. The original code would create a screen rectangle of
negative height and wreak havoc. This patch causes such strut to be ignored on
the screen it covers entirely, resulting in the desired behaviour of a small
strut at the top of screen 2.
Please note that this semantics of _NET_WM_STRUT and _NET_WM_STRUT_PARTIAL is
different to what is in wm-spec. The "correct" thing to do would be to discard
the covered portion of screen 1 leaving two narrow areas at the sides, but
this new behaviour is probably more desirable in many cases, at least for
xmonad/xmobar users.
The correct solution of having separate _NET_WM_STRUT_PARTIAL for each
Xinerama screen was mentioned in wm-spec maillist in 2007, but has never
really been proposed, discussed and included in wm-spec. Hence this "hack".
darcs-hash:20091119145043-c9ff5-b4494537b40d2d44abec5fbcec8ea7c3c3ef1a6b.gz
-rw-r--r-- | XMonad/Hooks/ManageDocks.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/XMonad/Hooks/ManageDocks.hs b/XMonad/Hooks/ManageDocks.hs index 314b634..fff4a5c 100644 --- a/XMonad/Hooks/ManageDocks.hs +++ b/XMonad/Hooks/ManageDocks.hs @@ -236,15 +236,18 @@ c2r (x1, y1, x2, y2) = Rectangle (fi x1) (fi y1) (fi $ x2 - x1 + 1) (fi $ y2 - y reduce :: RectC -> Strut -> RectC -> RectC reduce (sx0, sy0, sx1, sy1) (s, n, l, h) (x0, y0, x1, y1) = case s of - L | p (y0, y1) -> (mx x0 sx0 , y0 , x1 , y1 ) - R | p (y0, y1) -> (x0 , y0 , mn x1 sx1, y1 ) - U | p (x0, x1) -> (x0 , mx y0 sy0, x1 , y1 ) - D | p (x0, x1) -> (x0 , y0 , x1 , mn y1 sy1) - _ -> (x0 , y0 , x1 , y1 ) + L | p (y0, y1) && qh x1 -> (mx x0 sx0, y0 , x1 , y1 ) + R | p (y0, y1) && qv sx1 x0 -> (x0 , y0 , mn x1 sx1, y1 ) + U | p (x0, x1) && qh y1 -> (x0 , mx y0 sy0, x1 , y1 ) + D | p (x0, x1) && qv sy1 y0 -> (x0 , y0 , x1 , mn y1 sy1) + _ -> (x0 , y0 , x1 , y1 ) where mx a b = max a (b + n) mn a b = min a (b - n) p r = r `overlaps` (l, h) + -- Filter out struts that cover the entire rectangle: + qh d1 = n <= d1 + qv sd1 d0 = sd1 - n >= d0 -- | Do the two ranges overlap? -- |