diff options
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -148,6 +148,7 @@ struct Monitor { Monitor *next; Window barwin; const Layout *lt[2]; + int ltcur; /* current layout */ Pertag *pertag; }; @@ -220,6 +221,7 @@ static void sendmon(Client *c, Monitor *m); static void setclientstate(Client *c, long state); static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); +static void layoutscroll(const Arg *arg); static void setgaps(const Arg *arg); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); @@ -675,6 +677,7 @@ createmon(void) m->nmaster = nmaster; m->showbar = showbar; m->topbar = topbar; + m->ltcur = 0; m->gappx = gappx; m->lt[0] = &layouts[0]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; @@ -1601,6 +1604,25 @@ setgaps(const Arg *arg) } void +layoutscroll(const Arg *arg) +{ + if (!arg || !arg->i) + return; + int switchto = selmon->ltcur + arg->i; + int l = LENGTH(layouts); + + if (switchto == l) + switchto = 0; + else if(switchto < 0) + switchto = l - 1; + + selmon->ltcur = switchto; + Arg arg2 = {.v= &layouts[switchto] }; + setlayout(&arg2); + +} + +void setlayout(const Arg *arg) { if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) |
