RotSlaves.hs: Add rotAll functions

This commit is contained in:
Eric Mertens
2007-10-17 17:32:56 +00:00
parent 5abd5e39a6
commit 3e5c834c75

View File

@@ -12,8 +12,9 @@
-- and keep the focus in place. -- and keep the focus in place.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
module XMonadContrib.RotSlaves ( module XMonadContrib.RotSlaves (
-- $usage -- $usag
rotSlaves', rotSlavesUp, rotSlavesDown rotSlaves', rotSlavesUp, rotSlavesDown,
rotAll', rotAllUp, rotAllDown
) where ) where
import StackSet import StackSet
@@ -37,6 +38,7 @@ import XMonad
-- %import XMonadContrib.RotSlaves -- %import XMonadContrib.RotSlaves
-- %keybind , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp) -- %keybind , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp)
-- | Rotate the windows in the current stack excluding the first one
rotSlavesUp,rotSlavesDown :: X () rotSlavesUp,rotSlavesDown :: X ()
rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head l])) rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head l]))
rotSlavesDown = windows $ modify' (rotSlaves' (\l -> [last l]++(init l))) rotSlavesDown = windows $ modify' (rotSlaves' (\l -> [last l]++(init l)))
@@ -47,3 +49,12 @@ rotSlaves' f (Stack t [] rs) = Stack t [] (f rs) -- Master has
rotSlaves' f s@(Stack _ ls _ ) = Stack t' (reverse revls') rs' -- otherwise rotSlaves' f s@(Stack _ ls _ ) = Stack t' (reverse revls') rs' -- otherwise
where (master:ws) = integrate s where (master:ws) = integrate s
(revls',t':rs') = splitAt (length ls) (master:(f ws)) (revls',t':rs') = splitAt (length ls) (master:(f ws))
-- | Rotate the windows in the current stack
rotAllUp,rotAllDown :: X ()
rotAllUp = windows $ modify' (rotAll' (\l -> (tail l)++[head l]))
rotAllDown = windows $ modify' (rotAll' (\l -> [last l]++(init l)))
rotAll' :: ([a] -> [a]) -> Stack a -> Stack a
rotAll' f s = Stack r (reverse revls) rs
where (revls,r:rs) = splitAt (length (up s)) (f (integrate s))