summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoan MIlev <51526053+exorcist365@users.noreply.github.com>2021-07-13 01:01:19 +0300
committerGitHub <noreply@github.com>2021-07-12 23:01:19 +0100
commit23accf6c3acacb1c972961612cce1c7c831b11e7 (patch)
tree2b9865fffedb2ed4312d7c768f80bb920cd9c32e
parent802cd7ea845b804156ccdcce869526d178cf7e53 (diff)
downloadxmobar-23accf6c3acacb1c972961612cce1c7c831b11e7.tar.gz
xmobar-23accf6c3acacb1c972961612cce1c7c831b11e7.tar.bz2
Add TopH and BottomH for only controlling height of the window. (#556)
-rw-r--r--changelog.md2
-rw-r--r--doc/quick-start.org18
-rw-r--r--src/Xmobar/Config/Types.hs2
-rw-r--r--src/Xmobar/X11/Window.hs4
4 files changed, 24 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 105ea95..a155cb5 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,8 @@
_New features_
+ - New constructors for only controlling bar height:
+ TopH and BottomH for Top and Bottom respectively
- New monitor: k10temp (Sam Kirby)
- Better handling of command line arguments for Haskell-based
configuration keys (see #553 and #554)
diff --git a/doc/quick-start.org b/doc/quick-start.org
index 4b06057..c8cb6c9 100644
--- a/doc/quick-start.org
+++ b/doc/quick-start.org
@@ -29,8 +29,8 @@ the =Config= block in your configuration.
- =alpha= The transparency. 0 is transparent, 255 is opaque.
-- =position= Top, TopP, TopW, TopSize, Bottom, BottomP, BottomW,
- BottomSize or Static (with x, y, width and height).
+- =position= Top, TopH, TopP, TopW, TopSize, Bottom, BottomH,
+ BottomP, BottomW, BottomSize or Static (with x, y, width and height).
TopP and BottomP take 2 arguments: left padding and right padding.
@@ -42,9 +42,23 @@ the =Config= block in your configuration.
integer for the percentage width, and an integer for the minimum pixel
height that the xmobar window will have.
+ TopH and BottomH take one argument (Int) which adjusts the bar height.
+
For example:
#+begin_src haskell
+ position = TopH 30
+ #+end_src
+
+ to make a 30 tall bar on the top, or
+
+ #+begin_src haskell
+ position = BottomH 30
+ #+end_src
+
+ to make a 30 tall bar on the bottom of the screen.
+
+ #+begin_src haskell
position = BottomW C 75
#+end_src
diff --git a/src/Xmobar/Config/Types.hs b/src/Xmobar/Config/Types.hs
index 8d78f33..c31e460 100644
--- a/src/Xmobar/Config/Types.hs
+++ b/src/Xmobar/Config/Types.hs
@@ -68,10 +68,12 @@ data Config =
} deriving (Read, Show)
data XPosition = Top
+ | TopH Int
| TopW Align Int
| TopSize Align Int Int
| TopP Int Int
| Bottom
+ | BottomH Int
| 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 6de8e66..13c99f0 100644
--- a/src/Xmobar/X11/Window.hs
+++ b/src/Xmobar/X11/Window.hs
@@ -80,9 +80,11 @@ setPosition c p rs ht =
case p' of
Top -> Rectangle rx ry rw h
TopP l r -> Rectangle (rx + fi l) ry (rw - fi l - fi r) h
+ TopH ch -> Rectangle rx ry rw $ mh ch
TopW a i -> Rectangle (ax a i) ry (nw i) h
TopSize a i ch -> Rectangle (ax a i) ry (nw i) (mh ch)
Bottom -> Rectangle rx ny rw h
+ BottomH ch -> Rectangle rx ny rw $ mh ch
BottomW a i -> Rectangle (ax a i) ny (nw i) h
BottomP l r -> Rectangle (rx + fi l) ny (rw - fi l - fi r) h
BottomSize a i ch -> Rectangle (ax a i) (ny' ch) (nw i) (mh ch)
@@ -153,10 +155,12 @@ 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]
+ TopH _ -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0]
TopP _ _ -> [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]
TopSize {} -> [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]
+ BottomH _ -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]
BottomP _ _ -> [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]
BottomSize {} -> [0, 0, 0, sb, 0, 0, 0, 0, 0, 0, nx, nw]