summaryrefslogtreecommitdiffhomepage
path: root/Xmobar.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2008-08-06 22:50:29 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2008-08-06 22:50:29 +0200
commit9816ff2e0dbb51dded121fb69768555d65f0421c (patch)
tree4f0f9100f3cb869b8cf230100c690440def2fc3c /Xmobar.hs
parent25886ea48e9083240ce09f42755f6ef11455e51f (diff)
downloadxmobar-9816ff2e0dbb51dded121fb69768555d65f0421c.tar.gz
xmobar-9816ff2e0dbb51dded121fb69768555d65f0421c.tar.bz2
Add Support for positioning on certain screens
darcs-hash:20080806205029-a5988-84ceb56437a40b7213082922f55339e31059597a.gz
Diffstat (limited to 'Xmobar.hs')
-rw-r--r--Xmobar.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/Xmobar.hs b/Xmobar.hs
index fdc2446..5abdf86 100644
--- a/Xmobar.hs
+++ b/Xmobar.hs
@@ -128,20 +128,20 @@ startCommand (com,s,ss)
createWin :: Display -> XFont -> Config -> IO (Rectangle,Window)
createWin d fs c = do
let dflt = defaultScreen d
- sr:_ <- getScreenInfo d
+ srs <- getScreenInfo d
rootw <- rootWindow d dflt
(as,ds) <- textExtents fs "0"
let ht = as + ds + 4
- (r,o) = setPosition (position c) sr (fi ht)
+ (r,o) = setPosition (position c) srs (fi ht)
win <- newWindow d (defaultScreenOfDisplay d) rootw r o
selectInput d win (exposureMask .|. structureNotifyMask)
setProperties r c d win
mapWindow d win
return (r,win)
-setPosition :: XPosition -> Rectangle -> Dimension -> (Rectangle,Bool)
-setPosition p (Rectangle rx ry rw rh) ht =
- case p of
+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)
@@ -151,7 +151,11 @@ setPosition p (Rectangle rx ry rw rh) ht =
BottomW R i -> (Rectangle (right i) ny (nw i) h , True)
BottomW C i -> (Rectangle (center i) ny (nw i) h , True)
Static cx cy cw ch -> (Rectangle (fi cx ) (fi cy) (fi cw) (fi ch), True)
+ OnScreen _ _ -> error "Nested OnScreen positions are not allowed"
where
+ (Rectangle rx ry rw rh, p') = case p of
+ OnScreen i x -> (rs !! i, x)
+ _ -> (head rs, p)
ny = ry + fi (rh - ht)
center i = rx + (fi $ div (remwid i) 2)
right i = rx + (fi $ remwid i)