diff options
author | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-10-05 02:00:31 +0200 |
---|---|---|
committer | Spencer Janssen <sjanssen@cse.unl.edu> | 2007-10-05 02:00:31 +0200 |
commit | d26efdf84f8cc97f1e749463234e0b6b23577ed4 (patch) | |
tree | c5a350a84c25f3199b7aceccf8b7534de7e69047 | |
parent | 51193b17be6aeec0e81bd19a4db102798c8d0c7d (diff) | |
download | xmonad-d26efdf84f8cc97f1e749463234e0b6b23577ed4.tar.gz xmonad-d26efdf84f8cc97f1e749463234e0b6b23577ed4.tar.xz xmonad-d26efdf84f8cc97f1e749463234e0b6b23577ed4.zip |
Make WindowSet serialization robust to layout changes
darcs-hash:20071005000031-a5988-c8ab82b01a70dc7526fa64c71edc7673dbfab4db.gz
-rw-r--r-- | Main.hs | 13 | ||||
-rw-r--r-- | XMonad.hs | 3 |
2 files changed, 12 insertions, 4 deletions
@@ -52,9 +52,16 @@ main = do let initialWinset = new defaultLayout workspaces $ zipWith SD xinesc gaps - winset | ("--resume" : s : _) <- args - , [(x, "")] <- reads s = W.ensureTags defaultLayout workspaces x - | otherwise = initialWinset + maybeRead s = case reads s of + [(x, "")] -> Just x + _ -> Nothing + + winset = fromMaybe initialWinset $ do + ("--resume" : s : _) <- return args + ws <- maybeRead s + return . W.ensureTags defaultLayout workspaces + $ W.mapLayout (fromMaybe defaultLayout . maybeRead) ws + gaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0) cf = XConf @@ -218,8 +218,9 @@ spawn x = io $ do restart :: Maybe String -> Bool -> X () restart mprog resume = do prog <- maybe (io getProgName) return mprog - args <- if resume then gets (("--resume":) . return . show . windowset) else return [] + args <- if resume then gets (("--resume":) . return . showWs . windowset) else return [] catchIO (executeFile prog True args Nothing) + where showWs = show . mapLayout show -- | Run a side effecting action with the current workspace. Like 'when' but whenJust :: Maybe a -> (a -> X ()) -> X () |