From 8a646c9983206f6e36df9128ca6fa953f1561ff2 Mon Sep 17 00:00:00 2001 From: Devin Mullins Date: Sun, 18 May 2008 02:41:21 +0000 Subject: [PATCH] SwapWorkspaces: swapTo Next|Prev --- XMonad/Actions/SwapWorkspaces.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/XMonad/Actions/SwapWorkspaces.hs b/XMonad/Actions/SwapWorkspaces.hs index e4284bf0..c9b1143e 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