Re: [dev] [dwm] Mod+Space Cycle Through Layouts?

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Thu, 26 Aug 2010 08:30:00 +0100

On 26 August 2010 04:39, Calvin Young <calvinwyoung_AT_gmail.com> wrote:
> I recently switched to DWM from XMonad and am loving its minimalism and
> simplicity.  However, something I do miss from Xmonad and Awesome is the
> ability to cycle between layouts using Mod+Space.  I have all of my layouts
> bound to hotkeys, but it'd be nice to be able to cycle between them with one
> key combo.  It seems like such a simple feature that I can't believe I'm
> having such a difficult time finding a solution.  Does anyone have a patch
> for this?

Have a look at setlayout, you will need to add a NULL entry to
Layout[] in config.h and then write a very similar function to
setlayout() that iterates over layouts[] (starting at
selmon->lt[selmon->sellt]) and calls setlayout() as result, something
along the lines:

void
nextlayout(const Arg *arg) {
    Layout *l;
    for(l = layouts; l != selmon->lt[selmon->sellt]; l++);
    if(l && *(l+1))
        setlayout(l+1);
    else
        setlayout(layouts);
}

Note, this is untested, but should give you an idea how to achieve
what you want. It'll be crucial to NULL terminate layouts in config.h
to make this work.

Cheers,
Anselm
Received on Thu Aug 26 2010 - 09:30:00 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 26 2010 - 09:36:02 CEST