From db938a01bd9b956153b6427dab970732b5d29d4f Mon Sep 17 00:00:00 2001 From: nirav Date: Mon, 10 Feb 2020 13:31:07 +0000 Subject: Add shiftview --- README | 4 ++++ config.h | 4 ++++ dwm.c | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/README b/README index 95d4fd0..a18366f 100644 --- a/README +++ b/README @@ -46,3 +46,7 @@ Configuration ------------- The configuration of dwm is done by creating a custom config.h and (re)compiling the source code. + +Patches applied +------------- +Shiftview - https://lists.suckless.org/dev/1104/7590.html diff --git a/config.h b/config.h index d2f8a18..08d2112 100644 --- a/config.h +++ b/config.h @@ -94,6 +94,8 @@ static Key keys[] = { TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_q, quit, {0} }, { MODKEY, XK_q, killclient, {0} }, + { MODKEY, XK_a, shiftview, {.i = -1} }, + { MODKEY, XK_d, shiftview, {.i = +1} }, }; /* button definitions */ @@ -111,5 +113,7 @@ static Button buttons[] = { { ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + { ClkTagBar, 0, Button4, shiftview, {.i = -1} }, + { ClkTagBar, 0, Button5, shiftview, {.i = +1} }, }; diff --git a/dwm.c b/dwm.c index 8f8a72a..df8e268 100644 --- a/dwm.c +++ b/dwm.c @@ -233,6 +233,7 @@ static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void shiftview(const Arg *arg); /* variables */ static const char broken[] = "broken"; @@ -2124,6 +2125,21 @@ zoom(const Arg *arg) pop(c); } +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); +} + int main(int argc, char *argv[]) { -- cgit v1.2.3