aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2007-12-31 19:15:56 +0100
committerJoachim Breitner <mail@joachim-breitner.de>2007-12-31 19:15:56 +0100
commitf0b743e3ad16a47efe4768294aad95e7b8e71092 (patch)
tree37146f5fef798fe64249812112debcc5e8980104 /XMonad
parent34fc4a5028643602e4556f37b5a5de113bb22131 (diff)
downloadxmonad-f0b743e3ad16a47efe4768294aad95e7b8e71092.tar.gz
xmonad-f0b743e3ad16a47efe4768294aad95e7b8e71092.tar.xz
xmonad-f0b743e3ad16a47efe4768294aad95e7b8e71092.zip
Put the screen removing stuff in getCleanedScreenInfo
darcs-hash:20071231181556-23c07-0ff6a10eb151e7ea06e57f2c6317fe21f87309c8.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Operations.hs18
1 files changed, 13 insertions, 5 deletions
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs
index 71b9c31..db537d6 100644
--- a/XMonad/Operations.hs
+++ b/XMonad/Operations.hs
@@ -246,11 +246,11 @@ tileWindow w r = withDisplay $ \d -> do
-- ---------------------------------------------------------------------
--- | rescreen. The screen configuration may have changed (due to
--- xrandr), update the state and refresh the screen, and reset the gap.
-rescreen :: X ()
-rescreen = do
- xinesc' <- withDisplay (io . getScreenInfo)
+-- | getCleanedScreenInfo. reads the list of screens and removes
+-- duplicated or contained screens.
+getCleanedScreenInfo :: Display -> IO ([(ScreenId, Rectangle)])
+getCleanedScreenInfo dpy = do
+ xinesc' <- getScreenInfo dpy
let xinescN' = zip [0..] xinesc'
containedIn :: Rectangle -> Rectangle -> Bool
containedIn (Rectangle x1 y1 w1 h1) (Rectangle x2 y2 w2 h2) =
@@ -262,6 +262,14 @@ rescreen = do
xinescS' = filter (\(_,r1) -> not (any (\r2 -> r1 `containedIn` r2 && r1 /= r2) xinesc')) xinescN'
-- removes all duplicate screens but the first
xinesc = foldr (\r l -> if snd r `elem` map snd l then l else r:l) [] xinescS'
+ return xinesc
+
+
+-- | rescreen. The screen configuration may have changed (due to
+-- xrandr), update the state and refresh the screen, and reset the gap.
+rescreen :: X ()
+rescreen = do
+ xinesc <- withDisplay (io . getCleanedScreenInfo)
windows $ \ws@(W.StackSet { W.current = v, W.visible = vs, W.hidden = hs }) ->
let (xs, ys) = splitAt (length xinesc) $ map W.workspace (v:vs) ++ hs