diff options
author | Daniel Wagner <daniel@wagner-home.com> | 2009-12-30 08:46:04 +0100 |
---|---|---|
committer | Daniel Wagner <daniel@wagner-home.com> | 2009-12-30 08:46:04 +0100 |
commit | cf25ae10fa019378c5aa5c7381275bd475c11ed4 (patch) | |
tree | 251dc495ad73903dc265726683d08377ae74aea3 | |
parent | 90753ba80f9bce8a37c750b8bf7e4ca5dc346726 (diff) | |
download | xmobar-cf25ae10fa019378c5aa5c7381275bd475c11ed4.tar.gz xmobar-cf25ae10fa019378c5aa5c7381275bd475c11ed4.tar.bz2 |
add positions with height information
Ignore-this: 1244d13c44610fc3b1d9b73a0ebfac59
darcs-hash:20091230074604-76d51-a3415c7365aa22dfb9891cc6bb5c5ef4e726a805.gz
-rw-r--r-- | Config.hs | 2 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | Xmobar.hs | 16 |
3 files changed, 18 insertions, 7 deletions
@@ -58,8 +58,10 @@ data Config = data XPosition = Top | TopW Align Int + | TopSize Align Int Int | Bottom | BottomW Align Int + | BottomSize Align Int Int | Static {xpos, ypos, width, height :: Int} | OnScreen Int XPosition deriving ( Read, Eq ) @@ -131,13 +131,18 @@ Other configuration options: : Default font color. `position` -: Top, TopW, Bottom, BottomW or Static (with x, y, width and height). +: Top, TopW, TopSize, Bottom, BottomW, BottomSize or Static (with x, y, + width and height). : TopW and BottomW take 2 arguments: an alignment parameter (L for left, C for centered, R for Right) and an integer for the percentage width xmobar window will have in respect to the screen width. +: TopSize and BottomSize take 3 arguments: an alignment parameter, an + integer for the percentage width, and an integer for the minimum pixel + height that the xmobar window will have. + : For example: : position = BottomW C 75 @@ -147,13 +147,11 @@ setPosition :: XPosition -> [Rectangle] -> Dimension -> (Rectangle,Bool) setPosition p rs ht = case p' of Top -> (Rectangle rx ry rw h , True) - TopW L i -> (Rectangle rx ry (nw i) h , True) - TopW R i -> (Rectangle (right i) ry (nw i) h , True) - TopW C i -> (Rectangle (center i) ry (nw i) h , True) + TopW a i -> (Rectangle (ax a i ) ry (nw i ) h , True) + TopSize a i ch -> (Rectangle (ax a i ) ry (nw i ) (mh ch), True) Bottom -> (Rectangle rx ny rw h , True) - BottomW L i -> (Rectangle rx ny (nw i) h , True) - BottomW R i -> (Rectangle (right i) ny (nw i) h , True) - BottomW C i -> (Rectangle (center i) ny (nw i) h , True) + BottomW a i -> (Rectangle (ax a i ) ny (nw i ) h , True) + BottomSize a i ch -> (Rectangle (ax a i ) ny (nw i ) (mh ch), True) Static cx cy cw ch -> (Rectangle (fi cx ) (fi cy) (fi cw) (fi ch), True) OnScreen _ p'' -> setPosition p'' [scr] ht where @@ -164,9 +162,13 @@ setPosition p rs ht = center i = rx + (fi $ div (remwid i) 2) right i = rx + (fi $ remwid i) remwid i = rw - pw (fi i) + ax L = const rx + ax R = right + ax C = center pw i = rw * (min 100 i) `div` 100 nw = fi . pw . fi h = fi ht + mh h' = max (fi h') h safeIndex i = lookup i . zip [0..] @@ -192,8 +194,10 @@ getStrutValues r@(Rectangle x y w h) p rwh = OnScreen _ p' -> getStrutValues r p' rwh Top -> [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] 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] Static _ _ _ _ -> getStaticStrutValues p rwh where st = fi y + fi h sb = rwh - fi y |