diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-12-18 04:01:54 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-12-18 04:01:54 +0100 |
commit | 849c5cfb7544cbbe56dfdc7d450172121e51dff5 (patch) | |
tree | 36646362b5d7452c0a2c4facb4da82d6c417eec3 | |
parent | fa5443124c7aded9698e7683eca1e5c31a550ed4 (diff) | |
download | xmobar-849c5cfb7544cbbe56dfdc7d450172121e51dff5.tar.gz xmobar-849c5cfb7544cbbe56dfdc7d450172121e51dff5.tar.bz2 |
Better vertical alignment (stab at #56)
-rw-r--r-- | src/Xmobar.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs index a2f6062..b310f0f 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -209,7 +209,7 @@ createWin d fs c = do return (r,win) -- | Updates the size and position of the window -repositionWin :: Display -> Window -> XFont -> Config -> IO (Rectangle) +repositionWin :: Display -> Window -> XFont -> Config -> IO Rectangle repositionWin d win fs c = do srs <- getScreenInfo d (as,ds) <- textExtents fs "0" @@ -267,7 +267,7 @@ setProperties r c d w srs = do getProcessID >>= changeProperty32 d w p c1 propModeReplace . return . fromIntegral getRootWindowHeight :: [Rectangle] -> Int -getRootWindowHeight srs = foldr1 max (map getMaxScreenYCoord srs) +getRootWindowHeight srs = maximum (map getMaxScreenYCoord srs) where getMaxScreenYCoord sr = fi (rect_y sr) + fi (rect_height sr) @@ -365,8 +365,7 @@ printStrings dr gc fontst offs a sl@((s,c,l):xs) = do let (conf,d) = (config &&& display) r Rectangle _ _ wid ht = rect r totSLen = foldr (\(_,_,len) -> (+) len) 0 sl - fntsize = fi (as + ds) - valign = fi ht - 1 - (fi ht - fntsize) `div` 2 + valign = (fi ht `div` 2) + (fi (as + ds) `div` 3) remWidth = fi wid - fi totSLen offset = case a of C -> (remWidth + offs) `div` 2 |