diff --git a/config.def.h b/config.def.h index c14d435..ae13dfa 100644 --- a/config.def.h +++ b/config.def.h @@ -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 } }, diff --git a/dwm.c b/dwm.c index e5e598a..daf9d71 100644 --- a/dwm.c +++ b/dwm.c @@ -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) {