summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKrzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>2007-07-06 04:48:14 +0200
committerKrzysztof Kosciuszkiewicz <k.kosciuszkiewicz@gmail.com>2007-07-06 04:48:14 +0200
commit0b11566a389e54b4c5d891def5641a1dad7098a5 (patch)
treefe4a32e982a15e2fecc0e10e6b8ebcc5a73d7c9a
parent4025caa168743fd5cd1cd77046e3b99c79ced38b (diff)
downloadxmobar-0b11566a389e54b4c5d891def5641a1dad7098a5.tar.gz
xmobar-0b11566a389e54b4c5d891def5641a1dad7098a5.tar.bz2
Fix centered text align.
darcs-hash:20070706024814-ba08c-f6e828e21a3d20af358819e3cb6a13c29a4ff28e.gz
-rw-r--r--XMobar.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/XMobar.hs b/XMobar.hs
index 1e3a82a..ae8d5fe 100644
--- a/XMobar.hs
+++ b/XMobar.hs
@@ -142,9 +142,10 @@ printStrings gc fontst offs sl@((s,c,l):xs) =
let (_,asc,_,_) = textExtents fontst s
totSLen = foldr (\(_,_,len) -> (+) len) 0 sl
valign = (fromIntegral (height config) + fromIntegral asc) `div` 2
+ remWidth = fromIntegral (width config) - fromIntegral totSLen
offset = case (align config) of
- "center" -> (fromIntegral (width config) - fromIntegral totSLen) `div` 2
- "right" -> fromIntegral (width config) - fromIntegral totSLen - 1
+ "center" -> (remWidth + offs) `div` 2
+ "right" -> remWidth - 1
"left" -> offs
_ -> offs
color <- io $ initColor (display st) c