diff options
| author | krolyxon <krolyxon@tutanota.com> | 2022-06-05 13:02:48 +0530 |
|---|---|---|
| committer | krolyxon <krolyxon@tutanota.com> | 2022-06-05 13:02:48 +0530 |
| commit | 127d89b4246e3743ac24c425a80733cbf3dd832a (patch) | |
| tree | eae1db3acdaa2b940d965b1fda87ce17833a16c3 /dwm.c | |
| parent | 16de98fbf857c97b133469946ebf34487ed0e8a5 (diff) | |
layoutscroll patch
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]) |
