summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/quick-start.org3
-rw-r--r--src/Xmobar/Draw/Cairo.hs4
2 files changed, 4 insertions, 3 deletions
diff --git a/doc/quick-start.org b/doc/quick-start.org
index 2b34816..3f381fe 100644
--- a/doc/quick-start.org
+++ b/doc/quick-start.org
@@ -464,7 +464,8 @@ configuration language, see [[../etc/xmobar.config][etc/xmobar.config]], and you
- If the template has the form =L}M{R=, with L, R, M arbitrary specs, the
monitors in =L= are drawn first, aligned to the left, then =R=, aligned to
the right, and finally =M= is drawn centered in the bar. =R= is trimmed to
- the space left by =L=, and =M= is trimmed to the space left by =L= and =R=.
+ the space left by =L=, and =M= is trimmed to the space left by =L= and =R=. As
+ a particular case, =}M{= will draw a single segment centered in the bar.
- If the template has the form =L}{R=, =L= is drawn aligned to the left first
and then =R=, aligned to the right and trimmed if needed to fit in the
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
index 36f9bde..8dcda5d 100644
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -2,7 +2,7 @@
------------------------------------------------------------------------------
-- |
-- Module: Xmobar.X11.Cairo
--- Copyright: (c) 2022 Jose Antonio Ortega Ruiz
+-- Copyright: (c) 2022, 2023 Jose Antonio Ortega Ruiz
-- License: BSD3-style (see LICENSE)
--
-- Maintainer: jao@gnu.org
@@ -185,7 +185,7 @@ drawSegments dctx surf = do
(lend, as, bx) <- foldM (drawSegment dctx surf dw) (0, [], []) llyts
let [rw, cw] = map sWidth [rlyts, clyts]
rstart = max lend (dw - rw)
- cstart = if lend > 1 then max lend ((dw - cw) / 2.0) else lend
+ cstart = if lend > 1 || rw == 0 then max lend ((dw - cw) / 2.0) else lend
(_, as', bx') <- if cw > 0
then foldM (drawSegment dctx surf rstart) (cstart, as, bx) clyts
else return (0, as, bx)