From de224f0ead3c76d6dca4c72fd6c4def15ca858bc Mon Sep 17 00:00:00 2001 From: Dmitry Malikov Date: Sun, 20 Jan 2013 02:01:10 +0400 Subject: New XPositions: TopP and BottomP --- readme.md | 13 +++++++++++-- src/Config.hs | 3 +++ src/Window.hs | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index eb28a84..f98f3f2 100644 --- a/readme.md +++ b/readme.md @@ -200,8 +200,10 @@ Other configuration options: : Default font color. `position` -: Top, TopW, TopSize, Bottom, BottomW, BottomSize or Static (with x, y, - width and height). +: Top, TopP, TopW, TopSize, Bottom, BottomP, BottomW, BottomSize or Static + (with x, y, width and height). + +: TopP and BottomP take 2 arguments: left padding and right padding. : TopW and BottomW take 2 arguments: an alignment parameter (L for left, C for centered, R for Right) and an integer for the @@ -218,6 +220,13 @@ Other configuration options: : to place xmobar at the bottom, centered with the 75% of the screen width. +: Or: + +: position = BottomP 120 0 + +: to place xmobar at the bottom, with 120 pixel indent of the left. + + : Or : position = Static { xpos = 0 , ypos = 0, width = 1024, height = 15 } diff --git a/src/Config.hs b/src/Config.hs index 622c79c..6ab3f8d 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -23,6 +23,7 @@ module Config , runnableTypes ) where + import Commands import {-# SOURCE #-} Runnable import Plugins.Monitors @@ -73,7 +74,9 @@ data Config = data XPosition = Top | TopW Align Int | TopSize Align Int Int + | TopP Int Int | Bottom + | BottomP Int Int | BottomW Align Int | BottomSize Align Int Int | Static {xpos, ypos, width, height :: Int} diff --git a/src/Window.hs b/src/Window.hs index e9a67cf..f43fe4b 100644 --- a/src/Window.hs +++ b/src/Window.hs @@ -59,10 +59,12 @@ setPosition :: XPosition -> [Rectangle] -> Dimension -> (Rectangle,Bool) setPosition p rs ht = case p' of Top -> (Rectangle rx ry rw h, True) + TopP l r -> (Rectangle (rx + fi l) ry (rw - fi l - fi r) 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 a i -> (Rectangle (ax a i) ny (nw i) h, True) + BottomP l r -> (Rectangle (rx + fi l) ny (rw - fi l - fi r) h, True) BottomSize a i ch -> (Rectangle (ax a i) (ny' ch) (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 @@ -115,9 +117,11 @@ getStrutValues r@(Rectangle x y w h) p rwh = case p of OnScreen _ p' -> getStrutValues r p' rwh Top -> [0, 0, st, 0, 0, 0, 0, 0, nx, nw, 0, 0] + TopP _ _ -> [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] + BottomP _ _ -> [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 -- cgit v1.2.3