[Xmonad] Rotate window Stack

Karsten Schoelzel kuser at gmx.de
Thu Aug 2 16:00:29 EDT 2007


On Thu, Aug 02, 2007 at 09:19:38PM +0200, Hans Philipp Annen wrote:
> Hi Karsten,
> 
> this solution is much more elegant, nice :)
> If you agree, I will add both functions to RotSlaves.hs, rename them
> to rotSlavesUp and rotSlavesDown respectively and add you to the
> list of authors (and maintainers?).
> 
> Greetings
> 
> Hans Philipp
> 
> > I think I have a version which is easier to understand (at least for me):
> > 
> > rotSlaves' s@(SS.Stack _ [] [])   = s
> > rotSlaves' (SS.Stack t [] (r:rs)) = SS.Stack t [] (rs ++ [r])                  --Master has focus
> > rotSlaves' (SS.Stack t ls rs)     = SS.Stack t' (reverse (master:revls')) rs'  --otherwise
> >     where  (master:q:revls') = reverse (t:ls)
> >            (t':rs')          = (rs ++ [q])
> > 
> > Actually it rotates the slaves into the other direction (which made it
> > simpler), but that shouldn't matter much when using the TwoPane layout.

Hi Hans Philipp,

I just thought again about the direction your version rotated, and i
came up with this

rotSlavesDown s@(SS.Stack _ [] []) = s
rotSlavesDown (SS.Stack t [] rs)   = SS.Stack t [] ((last rs):(init rs))  --Master has focus
rotSlavesDown (SS.Stack t ls rs)   = SS.Stack t' ls' rs'                  --otherwise
    where (t':ls') = (init ls) ++ [last (t:rs)] ++ [last ls]
          rs'      = init (t:rs)

Feel free to add these functions to RotSlaves.hs and me as an author.

Greetings

Karsten


More information about the Xmonad mailing list