patch: shiftview

This commit is contained in:
frosty 2024-08-25 00:21:21 -04:00
parent ebbf1fd497
commit 353c2eca14
2 changed files with 18 additions and 0 deletions

View file

@ -112,6 +112,8 @@ static const Key keys[] = {
{ MODKEY, XK_s, togglesticky, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_y, shiftview, {.i = +1 } },
{ MODKEY|ShiftMask, XK_y, shiftview, {.i = -1 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },

16
dwm.c
View file

@ -226,6 +226,7 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
static void shiftview(const Arg *arg);
static void showhide(Client *c);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
@ -1879,6 +1880,21 @@ seturgent(Client *c, int urg)
XFree(wmh);
}
void
shiftview(const Arg *arg) {
Arg shifted;
if(arg->i > 0) // left circular shift
shifted.ui = (selmon->tagset[selmon->seltags] << arg->i)
| (selmon->tagset[selmon->seltags] >> (LENGTH(tags) - arg->i));
else // right circular shift
shifted.ui = selmon->tagset[selmon->seltags] >> (- arg->i)
| selmon->tagset[selmon->seltags] << (LENGTH(tags) + arg->i);
view(&shifted);
}
void
showhide(Client *c)
{