aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Mullins <me@twifkak.com>2008-05-18 04:41:21 +0200
committerDevin Mullins <me@twifkak.com>2008-05-18 04:41:21 +0200
commit079ed1807ff1e41cc1eacbf4bf3e53b92f548c2d (patch)
treed695059fc75a7d5858f00c22eae54f69b092fa60
parent2674799950c9e96f67c3b251fc3c6dcf460e46fb (diff)
downloadXMonadContrib-079ed1807ff1e41cc1eacbf4bf3e53b92f548c2d.tar.gz
XMonadContrib-079ed1807ff1e41cc1eacbf4bf3e53b92f548c2d.tar.xz
XMonadContrib-079ed1807ff1e41cc1eacbf4bf3e53b92f548c2d.zip
SwapWorkspaces: swapTo Next|Prev
darcs-hash:20080518024121-78224-1538cf1deee4ff65794d2c2fd171b807b44f7011.gz
-rw-r--r--XMonad/Actions/SwapWorkspaces.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/XMonad/Actions/SwapWorkspaces.hs b/XMonad/Actions/SwapWorkspaces.hs
index e4284bf..c9b1143 100644
--- a/XMonad/Actions/SwapWorkspaces.hs
+++ b/XMonad/Actions/SwapWorkspaces.hs
@@ -17,10 +17,15 @@ module XMonad.Actions.SwapWorkspaces (
-- * Usage
-- $usage
swapWithCurrent,
- swapWorkspaces
+ swapTo,
+ swapWorkspaces,
+ WSDirection(..)
) where
+import XMonad (windows, X())
import XMonad.StackSet
+import XMonad.Actions.CycleWS
+import XMonad.Util.WorkspaceCompare
-- $usage
@@ -45,6 +50,11 @@ import XMonad.StackSet
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
+-- | Say @swapTo Next@ or @swapTo Prev@ to move your current workspace.
+-- This is an @X ()@ so can be hooked up to your keybindings directly.
+swapTo :: WSDirection -> X ()
+swapTo dir = findWorkspace getSortByIndex dir AnyWS 1 >>= windows . swapWithCurrent
+
-- | Takes two workspace tags and an existing XMonad.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