summaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-10-01 19:06:28 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-10-01 19:06:28 +0200
commitd4a93abae6e1e07b855cb156cdec21bd404ce477 (patch)
tree7b0b85a49bc15abd7a2b18bb6ce1444adcd52249 /Main.hs
parent3930d2dff355be29c51932e7762b5cf85b4d6a55 (diff)
downloadmetatile-d4a93abae6e1e07b855cb156cdec21bd404ce477.tar
metatile-d4a93abae6e1e07b855cb156cdec21bd404ce477.zip
Operations.windows is responsible for setting initial properties, remove redundant code from Main
darcs-hash:20071001170628-a5988-060ba1e47986ae7b250bb05273f6d9b35a5ae9b0
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs28
1 files changed, 13 insertions, 15 deletions
diff --git a/Main.hs b/Main.hs
index 39e5dcd..414a283 100644
--- a/Main.hs
+++ b/Main.hs
@@ -50,9 +50,11 @@ main = do
hSetBuffering stdout NoBuffering
args <- getArgs
- let winset | ("--resume" : s : _) <- args
+ let initialWinset = new defaultLayout workspaces $ zipWith SD xinesc gaps
+
+ winset | ("--resume" : s : _) <- args
, [(x, "")] <- reads s = W.ensureTags defaultLayout workspaces x
- | otherwise = new defaultLayout workspaces $ zipWith SD xinesc gaps
+ | otherwise = initialWinset
gaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0)
cf = XConf
@@ -61,7 +63,7 @@ main = do
, normalBorder = nbc
, focusedBorder = fbc }
st = XState
- { windowset = winset
+ { windowset = initialWinset
, mapped = S.empty
, waitingUnmap = M.empty
, dragging = Nothing }
@@ -77,22 +79,18 @@ main = do
sync dpy False
- ws <- scan dpy rootw -- on the resume case, will pick up new windows
allocaXEvent $ \e ->
runX cf st $ do
- -- walk workspace, resetting X states/mask for windows
- -- TODO, general iterators for these lists.
- sequence_ [ setInitialProperties w >> reveal w
- | wk <- map W.workspace (W.current winset : W.visible winset)
- , w <- W.integrate' (W.stack wk) ]
-
- sequence_ [ setInitialProperties w >> hide w
- | wk <- W.hidden winset
- , w <- W.integrate' (W.stack wk) ]
+ -- bootstrap the windowset, Operations.windows will identify all
+ -- the windows in winset as new and set initial properties for
+ -- those windows
+ windows (const winset)
- mapM_ manage ws -- find new windows
- refresh
+ -- scan for all top-level windows, add the unmanaged ones to the
+ -- windowset
+ ws <- io $ scan dpy rootw
+ mapM_ manage ws
-- main loop, for all you HOF/recursion fans out there.
forever $ handle =<< io (nextEvent dpy e >> getEvent e)