diff options
author | Adam Vogt <vogt.adam@gmail.com> | 2009-04-20 02:57:32 +0200 |
---|---|---|
committer | Adam Vogt <vogt.adam@gmail.com> | 2009-04-20 02:57:32 +0200 |
commit | 0713a41374288b3caa464f7e1c5b6244ccf5c16b (patch) | |
tree | 7341af835296f63865010fd2863d36f6febc7b80 /Xmobar.hs | |
parent | 8b42afe1b1aec898e147a9846bedff112dcb181b (diff) | |
download | xmobar-0713a41374288b3caa464f7e1c5b6244ccf5c16b.tar.gz xmobar-0713a41374288b3caa464f7e1c5b6244ccf5c16b.tar.bz2 |
Accept the outermost OnScreen XPosition
Ignore-this: 9db9f39958618cf4c9ea91330f162aec
Takes the outermost directive. This implementation has the potentially
desirable side-effect of causing xmobar to run when given OnScreen 1, when
there is only 1 screen.
darcs-hash:20090420005732-1499c-280e2964039c8d3139d93cd52a0b9ab781b92bae.gz
Diffstat (limited to 'Xmobar.hs')
-rw-r--r-- | Xmobar.hs | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -40,6 +40,7 @@ import Control.Concurrent.STM import Control.Exception hiding (handle) import Data.Bits import Data.Char +import Data.Maybe(fromMaybe) import Config @@ -151,11 +152,11 @@ setPosition p rs 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" + OnScreen _ p'' -> setPosition p'' [scr] ht where - (Rectangle rx ry rw rh, p') = case p of - OnScreen i x -> (rs !! i, x) - _ -> (head rs, p) + (scr@(Rectangle rx ry rw rh), p') = + case p of OnScreen i x -> (fromMaybe (head rs) $ safeIndex i rs, x) + _ -> (head rs, p) ny = ry + fi (rh - ht) center i = rx + (fi $ div (remwid i) 2) right i = rx + (fi $ remwid i) @@ -164,6 +165,8 @@ setPosition p rs ht = nw = fi . pw . fi h = fi ht + safeIndex i = lookup i . zip [0..] + setProperties :: Rectangle -> Config -> Display -> Window -> [Rectangle] -> IO () setProperties r c d w srs = do a1 <- internAtom d "_NET_WM_STRUT_PARTIAL" False |