summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2008-02-07 10:11:40 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2008-02-07 10:11:40 +0100
commitb948a50f8392202d03b19efac3eead7b8b19cd54 (patch)
treefadbe77a5cb1877b8bcf99c5249f5b56230eb9d7
parent5bfcb6131b40139698d1f0ee7db4060f6facb034 (diff)
downloadmetatile-b948a50f8392202d03b19efac3eead7b8b19cd54.tar
metatile-b948a50f8392202d03b19efac3eead7b8b19cd54.zip
Remove non-existent windows on restart
darcs-hash:20080207091140-a5988-62b6074316ef87f2e728064f8262d9415ec9bee3
-rw-r--r--XMonad/Main.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/XMonad/Main.hs b/XMonad/Main.hs
index 0450a7c..7557ad6 100644
--- a/XMonad/Main.hs
+++ b/XMonad/Main.hs
@@ -16,6 +16,7 @@
module XMonad.Main (xmonad) where
import Data.Bits
+import Data.List ((\\))
import qualified Data.Map as M
import qualified Data.Set as S
import Control.Monad.Reader
@@ -103,15 +104,17 @@ xmonad initxmc = do
io $ sync dpy False
+ ws <- io $ scan dpy rootw
+
-- bootstrap the windowset, Operations.windows will identify all
-- the windows in winset as new and set initial properties for
- -- those windows
- windows (const winset)
+ -- those windows. Remove all windows that are no longer top-level
+ -- children of the root, they may have disappeared since
+ -- restarting.
+ windows . const . foldr W.delete winset $ W.allWindows winset \\ ws
- -- scan for all top-level windows, add the unmanaged ones to the
- -- windowset
- ws <- io $ scan dpy rootw
- mapM_ manage ws
+ -- manage the as-yet-unmanaged windows
+ mapM_ manage (ws \\ W.allWindows winset)
-- main loop, for all you HOF/recursion fans out there.
forever_ $ handle =<< io (nextEvent dpy e >> getEvent e)