aboutsummaryrefslogtreecommitdiffstats
path: root/SwapWorkspaces.hs
diff options
context:
space:
mode:
authorDevin Mullins <me@twifkak.com>2007-10-12 16:54:47 +0200
committerDevin Mullins <me@twifkak.com>2007-10-12 16:54:47 +0200
commit1254dd41509a031008799cb6850181705eae320b (patch)
treef758dfc093091880186e90fbcd38e6019123bc96 /SwapWorkspaces.hs
parentdb56cbb7ed63d02e70ecc24ab88a0342d1c99c5e (diff)
downloadXMonadContrib-1254dd41509a031008799cb6850181705eae320b.tar.gz
XMonadContrib-1254dd41509a031008799cb6850181705eae320b.tar.xz
XMonadContrib-1254dd41509a031008799cb6850181705eae320b.zip
haddock improvement
darcs-hash:20071012145447-78224-ddfc6b2085e85d92547aac3fc027c0dd4bad9cd3.gz
Diffstat (limited to '')
-rw-r--r--SwapWorkspaces.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/SwapWorkspaces.hs b/SwapWorkspaces.hs
index a6aff7e..277ae6a 100644
--- a/SwapWorkspaces.hs
+++ b/SwapWorkspaces.hs
@@ -12,9 +12,7 @@
-- each other, without having to move individual windows.
--
-- TODO: add quickcheck props for:
---
-- * double swap invariant (guarantees no 'loss' of workspaces)
---
-- * non-swapped ws's invariant
--
-----------------------------------------------------------------------------
@@ -43,10 +41,17 @@ import StackSet
-- %keybindlist ++
-- %keybindlist [((modMask .|. controlMask, k), windows $ swapWithCurrent i)
-- %keybindlist | (i, k) <- zip workspaces [xK_1 ..]]
+--
+-- After installing this update, if you're on workspace 1, hitting mod-ctrl-5
+-- will swap workspaces 1 and 5.
+-- | Swaps the currently focused workspace with the given workspace tag, via
+-- @swapWorkspaces@.
swapWithCurrent :: Eq i => i -> StackSet i l a s sd -> StackSet i l a s sd
swapWithCurrent t s = swapWorkspaces t (tag $ workspace $ current s) s
+-- | Takes two workspace tags and an existing StackSet and returns a new
+-- one with the two corresponding workspaces' tags swapped.
swapWorkspaces :: Eq i => i -> i -> StackSet i l a s sd -> StackSet i l a s sd
swapWorkspaces t1 t2 = mapWorkspace swap
where swap w = if tag w == t1 then w { tag = t2 }