From 0554a448bb27985e8d66940d077f54eda58d8e5a Mon Sep 17 00:00:00 2001 From: Kostas Agnantis Date: Thu, 27 Oct 2022 01:21:25 +0300 Subject: Adds new position configuration - TopHM: Top position with left/right/top margins and specific height - BottomHM: Bottom position with left/right/bottom margins and specific height --- src/Xmobar/Config/Types.hs | 2 ++ src/Xmobar/X11/Window.hs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/Xmobar/Config/Types.hs b/src/Xmobar/Config/Types.hs index df39f6d..1172034 100644 --- a/src/Xmobar/Config/Types.hs +++ b/src/Xmobar/Config/Types.hs @@ -89,11 +89,13 @@ data Config = data XPosition = Top | TopH Int + | TopHM Int Int Int Int -- left right top height | TopW Align Int | TopSize Align Int Int | TopP Int Int | Bottom | BottomH Int + | BottomHM Int Int Int Int -- left right bottom height | BottomP Int Int | BottomW Align Int | BottomSize Align Int Int diff --git a/src/Xmobar/X11/Window.hs b/src/Xmobar/X11/Window.hs index ad7ebf7..61d701e 100644 --- a/src/Xmobar/X11/Window.hs +++ b/src/Xmobar/X11/Window.hs @@ -86,10 +86,12 @@ setPosition c p rs ht = T.Top -> X.Rectangle rx ry rw h T.TopP l r -> X.Rectangle (rx + fi l) ry (rw - fi l - fi r) h T.TopH ch -> X.Rectangle rx ry rw (mh ch) + T.TopHM l r t ch -> X.Rectangle (rx + fi l) (ry + fi t) (rw - fi l - fi r) (mh ch) T.TopW a i -> X.Rectangle (ax a i) ry (nw i) h T.TopSize a i ch -> X.Rectangle (ax a i) ry (nw i) (mh ch) T.Bottom -> X.Rectangle rx ny rw h T.BottomH ch -> X.Rectangle rx (ny' ch) rw (mh ch) + T.BottomHM l r b ch -> X.Rectangle (rx + fi l) (ry + fi rh - fi b - fi (mh ch)) (rw - fi l - fi r) (mh ch) T.BottomW a i -> X.Rectangle (ax a i) ny (nw i) h T.BottomP l r -> X.Rectangle (rx + fi l) ny (rw - fi l - fi r) h T.BottomSize a i ch -> X.Rectangle (ax a i) (ny' ch) (nw i) (mh ch) @@ -163,11 +165,13 @@ getStrutValues r@(X.Rectangle x y w h) p rwh = T.OnScreen _ p' -> getStrutValues r p' rwh T.Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] T.TopH _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] + T.TopHM {} -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] T.TopP _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] T.TopW _ _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] T.TopSize {} -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] T.Bottom -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw] T.BottomH _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw] + T.BottomHM {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw] T.BottomP _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw] T.BottomW _ _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw] T.BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw] -- cgit v1.2.3