aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornirav <nirav@airmail.cc>2020-02-10 13:31:07 +0000
committernirav <nirav@airmail.cc>2020-02-10 13:32:15 +0000
commitdb938a01bd9b956153b6427dab970732b5d29d4f (patch)
treeea12ce60bab76a7a00c1df90b615040a7e7cb984
parentc6cdd3bf42f074689946ad73b1be64ee53d1a032 (diff)
downloaddwm-db938a01bd9b956153b6427dab970732b5d29d4f.tar.gz
dwm-db938a01bd9b956153b6427dab970732b5d29d4f.zip
Add shiftview
-rw-r--r--README4
-rw-r--r--config.h4
-rw-r--r--dwm.c16
3 files changed, 24 insertions, 0 deletions
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[])
{