From b948a50f8392202d03b19efac3eead7b8b19cd54 Mon Sep 17 00:00:00 2001 From: Spencer Janssen Date: Thu, 7 Feb 2008 10:11:40 +0100 Subject: Remove non-existent windows on restart darcs-hash:20080207091140-a5988-62b6074316ef87f2e728064f8262d9415ec9bee3 --- XMonad/Main.hs | 15 +++++++++------ 1 file 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) -- cgit v1.2.3