mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-06 23:21:52 -07:00
Export focusUp' and focusDown' -- work entirely on stacks
This commit is contained in:
@@ -35,7 +35,7 @@ module XMonad.StackSet (
|
|||||||
-- * Operations on the current stack
|
-- * Operations on the current stack
|
||||||
-- $stackOperations
|
-- $stackOperations
|
||||||
peek, index, integrate, integrate', differentiate,
|
peek, index, integrate, integrate', differentiate,
|
||||||
focusUp, focusDown, focusMaster, focusWindow,
|
focusUp, focusDown, focusUp', focusDown', focusMaster, focusWindow,
|
||||||
tagMember, renameTag, ensureTags, member, findTag, mapWorkspace, mapLayout,
|
tagMember, renameTag, ensureTags, member, findTag, mapWorkspace, mapLayout,
|
||||||
-- * Modifying the stackset
|
-- * Modifying the stackset
|
||||||
-- $modifyStackset
|
-- $modifyStackset
|
||||||
@@ -342,15 +342,19 @@ index = with [] integrate
|
|||||||
--
|
--
|
||||||
focusUp, focusDown, swapUp, swapDown :: StackSet i l a s sd -> StackSet i l a s sd
|
focusUp, focusDown, swapUp, swapDown :: StackSet i l a s sd -> StackSet i l a s sd
|
||||||
focusUp = modify' focusUp'
|
focusUp = modify' focusUp'
|
||||||
focusDown = modify' (reverseStack . focusUp' . reverseStack)
|
focusDown = modify' focusDown'
|
||||||
|
|
||||||
swapUp = modify' swapUp'
|
swapUp = modify' swapUp'
|
||||||
swapDown = modify' (reverseStack . swapUp' . reverseStack)
|
swapDown = modify' (reverseStack . swapUp' . reverseStack)
|
||||||
|
|
||||||
focusUp', swapUp' :: Stack a -> Stack a
|
-- | Variants of 'focusUp' and 'focusDown' that work on a
|
||||||
|
-- 'Stack' rather than an entire 'StackSet'.
|
||||||
|
focusUp', focusDown' :: Stack a -> Stack a
|
||||||
focusUp' (Stack t (l:ls) rs) = Stack l ls (t:rs)
|
focusUp' (Stack t (l:ls) rs) = Stack l ls (t:rs)
|
||||||
focusUp' (Stack t [] rs) = Stack x xs [] where (x:xs) = reverse (t:rs)
|
focusUp' (Stack t [] rs) = Stack x xs [] where (x:xs) = reverse (t:rs)
|
||||||
|
focusDown' = reverseStack . focusUp' . reverseStack
|
||||||
|
|
||||||
|
swapUp' :: Stack a -> Stack a
|
||||||
swapUp' (Stack t (l:ls) rs) = Stack t ls (l:rs)
|
swapUp' (Stack t (l:ls) rs) = Stack t ls (l:rs)
|
||||||
swapUp' (Stack t [] rs) = Stack t (reverse rs) []
|
swapUp' (Stack t [] rs) = Stack t (reverse rs) []
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user