module XMonad.Actions.SwapWorkspaces (
swapWithCurrent,
swapTo,
swapWorkspaces,
Direction1D(..)
) where
import XMonad (windows, X())
import XMonad.StackSet
import XMonad.Actions.CycleWS
import XMonad.Util.WorkspaceCompare
swapWithCurrent :: Eq i => i -> StackSet i l a s sd -> StackSet i l a s sd
swapWithCurrent :: forall i l a s sd.
Eq i =>
i -> StackSet i l a s sd -> StackSet i l a s sd
swapWithCurrent i
t StackSet i l a s sd
s = forall i l a s sd.
Eq i =>
i -> i -> StackSet i l a s sd -> StackSet i l a s sd
swapWorkspaces i
t (forall i l a s sd. StackSet i l a s sd -> i
currentTag StackSet i l a s sd
s) StackSet i l a s sd
s
swapTo :: Direction1D -> X ()
swapTo :: Direction1D -> X ()
swapTo Direction1D
dir = X WorkspaceSort -> Direction1D -> WSType -> Int -> X WorkspaceId
findWorkspace X WorkspaceSort
getSortByIndex Direction1D
dir WSType
anyWS Int
1 forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (WindowSet -> WindowSet) -> X ()
windows forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall i l a s sd.
Eq i =>
i -> StackSet i l a s sd -> StackSet i l a s sd
swapWithCurrent
swapWorkspaces :: Eq i => i -> i -> StackSet i l a s sd -> StackSet i l a s sd
swapWorkspaces :: forall i l a s sd.
Eq i =>
i -> i -> StackSet i l a s sd -> StackSet i l a s sd
swapWorkspaces i
t1 i
t2 = forall i l a s sd.
(Workspace i l a -> Workspace i l a)
-> StackSet i l a s sd -> StackSet i l a s sd
mapWorkspace forall {l} {a}. Workspace i l a -> Workspace i l a
swap
where swap :: Workspace i l a -> Workspace i l a
swap Workspace i l a
w
| forall i l a. Workspace i l a -> i
tag Workspace i l a
w forall a. Eq a => a -> a -> Bool
== i
t1 = Workspace i l a
w { tag :: i
tag = i
t2 }
| forall i l a. Workspace i l a -> i
tag Workspace i l a
w forall a. Eq a => a -> a -> Bool
== i
t2 = Workspace i l a
w { tag :: i
tag = i
t1 }
| Bool
otherwise = Workspace i l a
w