aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Philipp Annen <haphi@gmx.net>2007-08-02 11:44:08 +0200
committerHans Philipp Annen <haphi@gmx.net>2007-08-02 11:44:08 +0200
commitc17e168199841f228c0244dd911bd81a37ca214a (patch)
tree1eb3bbc06cff9851448dd1b5261c3a8d1562a497
parent3322e202df73228263c588d50dbb2b6e0f117433 (diff)
downloadXMonadContrib-c17e168199841f228c0244dd911bd81a37ca214a.tar.gz
XMonadContrib-c17e168199841f228c0244dd911bd81a37ca214a.tar.xz
XMonadContrib-c17e168199841f228c0244dd911bd81a37ca214a.zip
RotSlaves
darcs-hash:20070802094408-89d1d-b0695b4cdbd29c303936544412419594dcabda41.gz
-rw-r--r--RotSlaves.hs47
1 files changed, 47 insertions, 0 deletions
diff --git a/RotSlaves.hs b/RotSlaves.hs
new file mode 100644
index 0000000..6bda6e7
--- /dev/null
+++ b/RotSlaves.hs
@@ -0,0 +1,47 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : XMonadContrib.RotSlaves
+-- Copyright : (c) Hans Philipp Annen <haphi@gmx.net>, Mischa Dieterle <der_m@freenet.de>
+-- License : BSD3-style (see LICENSE)
+--
+-- Maintainer : Hans Philipp Annen <haphi@gmx.net>
+-- Stability : unstable
+-- Portability : unportable
+--
+-- Rotate all windows except the master window
+-- and keep the focus in place.
+-----------------------------------------------------------------------------
+module XMonadContrib.RotSlaves (
+ -- $usage
+ rotSlaves', rotSlaves
+ ) where
+
+import qualified StackSet as SS
+
+-- $usage
+--
+-- To use this module, import it with:
+--
+-- > import XMonadContrib.RotSlaves
+--
+-- and add a keybinding:
+--
+-- , ((modMask .|. shiftMask, xK_Tab ), windows rotSlaves)
+--
+--
+-- This operation will rotate all windows except the master window, while the focus
+-- stays where it is. It is usefull together with the TwoPane-Layout (see XMonadContrib.TwoPane).
+--
+
+rotSlaves :: SS.StackSet i a s sd -> SS.StackSet i a s sd
+rotSlaves = SS.modify' rotSlaves'
+
+rotSlaves' :: SS.Stack a -> SS.Stack a
+rotSlaves' (SS.Stack t ls rs) | (null ls) = SS.Stack t [] ((rearRs)++(frontRs)) --Master has focus
+ | otherwise = SS.Stack t' (reverse ((master)++revls')) rs' --otherwise
+ where (frontRs, rearRs) = splitAt (max 0 ((length rs) - 1)) rs
+ (ils, master) = splitAt (max 0 ((length ls) - 1)) ls
+ toBeRotated = (reverse ils)++(t:rs)
+ (revls',t':rs') = splitAt (length ils) ((last toBeRotated):(init toBeRotated))
+
+