aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Mertens <emertens@galois.com>2007-10-17 19:32:56 +0200
committerEric Mertens <emertens@galois.com>2007-10-17 19:32:56 +0200
commitcb0b22bec8d208c89e335fbb5c66345ae7f4ba60 (patch)
tree0a1475146ece282c75db14373cebb66d6acbd689
parent5e1465c41f8e5c9c444d070be0fcd1f7e86dfa89 (diff)
downloadXMonadContrib-cb0b22bec8d208c89e335fbb5c66345ae7f4ba60.tar.gz
XMonadContrib-cb0b22bec8d208c89e335fbb5c66345ae7f4ba60.tar.xz
XMonadContrib-cb0b22bec8d208c89e335fbb5c66345ae7f4ba60.zip
RotSlaves.hs: Add rotAll functions
darcs-hash:20071017173256-b49f3-02e85aecc376194cd2130daad5b9cfcd8f5399b1.gz
-rw-r--r--RotSlaves.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/RotSlaves.hs b/RotSlaves.hs
index d26c33e..91df10f 100644
--- a/RotSlaves.hs
+++ b/RotSlaves.hs
@@ -12,8 +12,9 @@
-- and keep the focus in place.
-----------------------------------------------------------------------------
module XMonadContrib.RotSlaves (
- -- $usage
- rotSlaves', rotSlavesUp, rotSlavesDown
+ -- $usag
+ rotSlaves', rotSlavesUp, rotSlavesDown,
+ rotAll', rotAllUp, rotAllDown
) where
import StackSet
@@ -28,7 +29,7 @@ import XMonad
--
-- and add a keybinding:
--
--- > , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp)
+-- > , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp)
--
--
-- This operation will rotate all windows except the master window, while the focus
@@ -37,6 +38,7 @@ import XMonad
-- %import XMonadContrib.RotSlaves
-- %keybind , ((modMask .|. shiftMask, xK_Tab ), rotSlavesUp)
+-- | Rotate the windows in the current stack excluding the first one
rotSlavesUp,rotSlavesDown :: X ()
rotSlavesUp = windows $ modify' (rotSlaves' (\l -> (tail l)++[head 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
where (master:ws) = integrate s
(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))