summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-05-21 07:52:53 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-05-21 07:52:53 +0200
commitf9326aecb597dad6e20687f7cf533d95b80f5c45 (patch)
treef2387b4761caa8ea4e38df5d00eeabb21f52f186 /Operations.hs
parent73725db0c3313332832d102aa80e9582a810c643 (diff)
downloadmetatile-f9326aecb597dad6e20687f7cf533d95b80f5c45.tar
metatile-f9326aecb597dad6e20687f7cf533d95b80f5c45.zip
Move xinerama current/visible/hidden workspace logic into StackSet directly.
darcs-hash:20070521055253-9c5c1-4cc51fadb10609340f798aece25097afeae92dbb
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/Operations.hs b/Operations.hs
index 678206e..37dbafe 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -65,11 +65,12 @@ shift n = withFocused hide >> windows (W.shift n)
-- | view. Change the current workspace to workspace at offset n (0 indexed).
view :: WorkspaceId -> X ()
-view n = withWorkspace $ \w -> when (n /= (W.tag (W.current w))) $ do
+view n = withWorkspace $ \old -> when (n /= (W.tag (W.workspace (W.current old)))) $ do
windows $ W.view n -- move in new workspace first, to avoid flicker
+
-- Hide the old workspace if it is no longer visible
- oldWsNotVisible <- (not . M.member (W.tag . W.current $ w) . W.screens) `liftM` gets windowset
- when oldWsNotVisible $ mapM_ hide (W.index w)
+ oldWsNotVisible <- liftM (notElem (W.current old)) (gets (W.visible . windowset))
+ when oldWsNotVisible $ mapM_ hide (W.index old)
clearEnterEvents -- better clear any events from the old workspace
-- | Kill the currently focused client. If we do kill it, we'll get a
@@ -114,12 +115,13 @@ refresh = do
XConf { xineScreens = xinesc, display = d } <- ask
-- for each workspace, layout the currently visible workspaces
- flip mapM_ (M.assocs (W.screens ws)) $ \(n, scn) -> do
- let this = W.view n ws
+ (`mapM_` (W.current ws : W.visible ws)) $ \w -> do
+ let n = W.tag (W.workspace w)
+ this = W.view n ws
Just l = fmap fst $ M.lookup n fls
-- now tile the windows on this workspace
- rs <- doLayout l (genericIndex xinesc scn) (W.index this)
- mapM_ (\(w,rect) -> io (tileWindow d w rect)) rs
+ rs <- doLayout l (genericIndex xinesc (W.screen w)) (W.index this)
+ mapM_ (\(win,rect) -> io (tileWindow d win rect)) rs
-- and raise the focused window if there is one.
whenJust (W.peek this) $ io . raiseWindow d
@@ -178,8 +180,8 @@ setFocusX w = withWorkspace $ \ws -> do
XConf { display = dpy , normalBorder = nbc, focusedBorder = fbc } <- ask
-- clear mouse button grab and border on other windows
- (`mapM_` (M.keys . W.screens $ ws)) $ \n -> do
- (`mapM_` (W.index (W.view n ws))) $ \otherw -> do
+ (`mapM_` (W.current ws : W.visible ws)) $ \wk -> do
+ (`mapM_` (W.index (W.view (W.tag (W.workspace wk)) ws))) $ \otherw -> do
setButtonGrab True otherw
io $ setWindowBorder dpy otherw (color_pixel nbc)
@@ -282,7 +284,7 @@ splitVerticallyBy f r = (\(a,b)->(mirrorRect a,mirrorRect b)) $ splitHorizontall
layout :: ((Layout, [Layout]) -> (Layout, [Layout])) -> X ()
layout f = do
modify $ \s ->
- let n = W.tag . W.current . windowset $ s
+ let n = W.tag . W.workspace . W.current . windowset $ s
(Just fl) = M.lookup n $ layouts s
in s { layouts = M.insert n (f fl) (layouts s) }
refresh