summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Xmobar.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Xmobar.hs b/Xmobar.hs
index d3c252d..2380fd1 100644
--- a/Xmobar.hs
+++ b/Xmobar.hs
@@ -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