From 0b11566a389e54b4c5d891def5641a1dad7098a5 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosciuszkiewicz Date: Fri, 6 Jul 2007 04:48:14 +0200 Subject: Fix centered text align. darcs-hash:20070706024814-ba08c-f6e828e21a3d20af358819e3cb6a13c29a4ff28e.gz --- XMobar.hs | 5 +++-- 1 file 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 -- cgit v1.2.3