aboutsummaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-09 06:54:17 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-09 06:54:17 +0100
commita192f6137313a60c35f6513cd8aa0237870bf358 (patch)
treea2c93e6591341d5eebeae9ebf557608fd0cd3686 /Main.hs
parentf7f7ad812cdf891d094f415d5b712792d1c0f603 (diff)
downloadxmonad-a192f6137313a60c35f6513cd8aa0237870bf358.tar.gz
xmonad-a192f6137313a60c35f6513cd8aa0237870bf358.tar.xz
xmonad-a192f6137313a60c35f6513cd8aa0237870bf358.zip
refactor, -10 or so loc
darcs-hash:20070309055417-9c5c1-6d4119932cae7f8f885b0d1ce674efc25f7488e8.gz
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/Main.hs b/Main.hs
index 4a7a914..76fd0d7 100644
--- a/Main.hs
+++ b/Main.hs
@@ -147,14 +147,18 @@ refresh :: W ()
refresh = do
ws <- gets workspace
whenJust (W.peek ws) $ \w ->
- withScreen $ \(d,sw,sh) -> io $ do
- moveResizeWindow d w 0 0 (fromIntegral sw) (fromIntegral sh) -- fullscreen
- raiseWindow d w
+ withDisplay $ \d -> do
+ sw <- gets screenWidth
+ sh <- gets screenHeight
+ io $ do moveResizeWindow d w 0 0 (fromIntegral sw) (fromIntegral sh) -- fullscreen
+ raiseWindow d w
-- | hide. Hide a list of windows by moving them offscreen.
hide :: Window -> W ()
-hide w = withScreen $ \(dpy,sw,sh) -> io $
- moveWindow dpy w (2*fromIntegral sw) (2*fromIntegral sh)
+hide w = withDisplay $ \d -> do
+ sw <- gets screenWidth
+ sh <- gets screenHeight
+ io $ moveWindow d w (2*fromIntegral sw) (2*fromIntegral sh)
-- | reveal. Expose a list of windows, moving them on screen
reveal :: Window -> W ()
@@ -162,7 +166,11 @@ reveal w = withDisplay $ \d -> io $ moveWindow d w 0 0
-- | windows. Modify the current window list with a pure function, and refresh
windows :: (WorkSpace -> WorkSpace) -> W ()
-windows f = modifyWorkspace f >> refresh
+windows f = do
+ modify $ \s -> s { workspace = f (workspace s) }
+ ws <- gets workspace
+ refresh
+ trace (show ws) -- log state changes to stderr
-- ---------------------------------------------------------------------
-- Window operations