aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Actions
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2009-11-15 03:27:51 +0100
committerAdam Vogt <vogt.adam@gmail.com>2009-11-15 03:27:51 +0100
commitaf442ded0759b24906eac4f71a369207020345d7 (patch)
tree7d4a0dbde5668454e2797059007af0acb1683329 /XMonad/Actions
parent3df209655f52c3a10fb2d0598908f26f5d4a2f23 (diff)
downloadXMonadContrib-af442ded0759b24906eac4f71a369207020345d7.tar.gz
XMonadContrib-af442ded0759b24906eac4f71a369207020345d7.tar.xz
XMonadContrib-af442ded0759b24906eac4f71a369207020345d7.zip
Minor style changes in DynamicWorkspaces
Ignore-this: 1a6018ab134e4420a949354575a8a110 darcs-hash:20091115022751-1499c-c2f8ccf3cada9e16a5d35e87e41baa160c74e774.gz
Diffstat (limited to 'XMonad/Actions')
-rw-r--r--XMonad/Actions/DynamicWorkspaces.hs33
1 files changed, 15 insertions, 18 deletions
diff --git a/XMonad/Actions/DynamicWorkspaces.hs b/XMonad/Actions/DynamicWorkspaces.hs
index 032f012..c9409ad 100644
--- a/XMonad/Actions/DynamicWorkspaces.hs
+++ b/XMonad/Actions/DynamicWorkspaces.hs
@@ -124,14 +124,11 @@ addHiddenWorkspace newtag =
-- | Remove the current workspace if it contains no windows.
removeEmptyWorkspace :: X ()
-removeEmptyWorkspace = do t <- (tag.workspace.current) `fmap` gets windowset
- removeEmptyWorkspaceByTag t
+removeEmptyWorkspace = gets (currentTag . windowset) >>= removeEmptyWorkspaceByTag
-- | Remove the current workspace.
removeWorkspace :: X ()
-removeWorkspace = do t <- (tag.workspace.current) `fmap` gets windowset
- removeWorkspaceByTag t
-
+removeWorkspace = gets (currentTag . windowset) >>= removeWorkspaceByTag
-- | Remove workspace with specific tag if it contains no windows. Only works
-- on the current or the last workspace.
@@ -140,13 +137,13 @@ removeEmptyWorkspaceByTag t = whenX (isEmpty t) $ removeWorkspaceByTag t
-- | Remove workspace with specific tag. Only works on the current or the last workspace.
removeWorkspaceByTag :: String -> X ()
-removeWorkspaceByTag torem = do s <- gets windowset
- case s of
- StackSet { current = Screen { workspace = cur }
- , hidden = (w:_) }
- -> do when (torem==tag cur) $ windows $ view $ tag w
- windows $ removeWorkspace' torem
- _ -> return ()
+removeWorkspaceByTag torem = do
+ s <- gets windowset
+ case s of
+ StackSet { current = Screen { workspace = cur }, hidden = (w:_) } -> do
+ when (torem==tag cur) $ windows $ view $ tag w
+ windows $ removeWorkspace' torem
+ _ -> return ()
-- | Remove the current workspace after an operation if it is empty and hidden.
-- Can be used to remove a workspace if it is empty when leaving it. The
@@ -158,16 +155,16 @@ removeEmptyWorkspaceAfter = removeEmptyWorkspaceAfterExcept []
-- | Like 'removeEmptyWorkspaceAfter' but use a list of sticky workspaces,
-- whose entries will never be removed.
removeEmptyWorkspaceAfterExcept :: [String] -> X () -> X ()
-removeEmptyWorkspaceAfterExcept sticky f = do before <- getTag
- f
- after <- getTag
- when (before/=after && before `notElem` sticky) $ removeEmptyWorkspaceByTag before
- where getTag = (tag.workspace.current) `fmap` gets windowset
+removeEmptyWorkspaceAfterExcept sticky f = do
+ before <- gets (currentTag . windowset)
+ f
+ after <- gets (currentTag . windowset)
+ when (before/=after && before `notElem` sticky) $ removeEmptyWorkspaceByTag before
isEmpty :: String -> X Bool
isEmpty t = do wsl <- gets $ workspaces . windowset
let mws = find (\ws -> tag ws == t) wsl
- return $ maybe True (isNothing.stack) mws
+ return $ maybe True (isNothing . stack) mws
addHiddenWorkspace' :: i -> l -> StackSet i l a sid sd -> StackSet i l a sid sd
addHiddenWorkspace' newtag l s@(StackSet { hidden = ws }) = s { hidden = Workspace newtag l Nothing:ws }