summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Sackville-West <andrew@swclan.homelinux.org>2008-12-07 21:23:34 +0100
committerAndrew Sackville-West <andrew@swclan.homelinux.org>2008-12-07 21:23:34 +0100
commit605e62b06fafad48da7b1ad84972e575f2a500b3 (patch)
tree6bf9241b96e6d3d12ff8ca60d4cb0b63c5bf4ca1
parent67807cc2d1647c6f70ac1d3ceff10bde786a40f6 (diff)
downloadxmobar-605e62b06fafad48da7b1ad84972e575f2a500b3.tar.gz
xmobar-605e62b06fafad48da7b1ad84972e575f2a500b3.tar.bz2
Create _NEW_WM_STRUT_PARTIAL properties for Static position
darcs-hash:20081207202334-f44e0-f3c10cbcdba00ab3e77646ec570a423be5d0cbc7.gz
-rw-r--r--Xmobar.hs25
1 files changed, 19 insertions, 6 deletions
diff --git a/Xmobar.hs b/Xmobar.hs
index 8246efd..823abc4 100644
--- a/Xmobar.hs
+++ b/Xmobar.hs
@@ -183,17 +183,30 @@ getRootWindowHeight srs = foldr1 max (map getMaxScreenYCoord srs)
getStrutValues :: Rectangle -> XPosition -> Int -> [Int]
getStrutValues r@(Rectangle x y w h) p rwh =
case p of
- OnScreen _ p' -> getStrutValues r p' rwh
- Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
- TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
- Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
- BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
- _ -> [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+ OnScreen _ p' -> getStrutValues r p' rwh
+ Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
+ TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
+ Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
+ BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
+ Static _ _ _ _ -> getStaticStrutValues p rwh
where st = fi y + fi h
sb = rwh - fi y
nx = fi x
nw = fi (x + fi w - 1)
+-- get some reaonable strut values for static placement.
+getStaticStrutValues :: XPosition -> Int -> [Int]
+getStaticStrutValues (Static cx cy cw ch) rwh
+ -- if the yPos is in the top half of the screen, then assume a Top
+ -- placement, otherwise, it's a Bottom placement
+ | cy < (rwh `div` 2) = [0, 0, st, 0, 0, 0, 0, 0, xs, xe, 0, 0]
+ | otherwise = [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, xs, xe]
+ where st = cy + ch
+ sb = rwh - cy
+ xs = cx -- a simple calculation for horizontal (x) placement
+ xe = xs + cw
+getStaticStrutValues _ _ = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+
updateWin :: TVar String -> X ()
updateWin v = do
xc <- ask