diff options
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 |