summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-07-04 11:25:28 +0200
committerbakkeby <[email protected]>2022-07-04 11:28:23 +0200
commita15a25992646856066e986d070be5aa6a28e9d2b (patch)
tree2fa891201064f8e81ed158d5dce503546beb6ccd /patch
parent404401622b89b8e9f9d76b8ec28129623387d737 (diff)
downloaddwm-flexipatch-a15a25992646856066e986d070be5aa6a28e9d2b.tar.gz
dwm-flexipatch-a15a25992646856066e986d070be5aa6a28e9d2b.zip
Adding shifttag patch ref. #270
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/shifttag.c20
-rw-r--r--patch/shifttag.h1
4 files changed, 27 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c
index 17f2e81..20ac9df 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -232,6 +232,9 @@
#if SETBORDERPX_PATCH
#include "setborderpx.c"
#endif
+#if SHIFTTAG_PATCH
+#include "shifttag.c"
+#endif
#if SHIFTVIEW_PATCH
#include "shiftview.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 0cf267a..6806b59 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -234,6 +234,9 @@
#if SETBORDERPX_PATCH
#include "setborderpx.h"
#endif
+#if SHIFTTAG_PATCH
+#include "shifttag.h"
+#endif
#if SHIFTVIEW_PATCH
#include "shiftview.h"
#endif
diff --git a/patch/shifttag.c b/patch/shifttag.c
new file mode 100644
index 0000000..97365f1
--- /dev/null
+++ b/patch/shifttag.c
@@ -0,0 +1,20 @@
+/* Sends a window to the next/prev tag */
+void
+shifttag(const Arg *arg)
+{
+ Arg shifted;
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #else
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #endif // SCRATCHPADS_PATCH
+
+ if (arg->i > 0) /* left circular shift */
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (NUMTAGS - arg->i)));
+ else /* right circular shift */
+ shifted.ui = ((shifted.ui >> -arg->i) | (shifted.ui << (NUMTAGS + arg->i)));
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui &= ~SPTAGMASK;
+ #endif // SCRATCHPADS_PATCH
+ tag(&shifted);
+}
diff --git a/patch/shifttag.h b/patch/shifttag.h
new file mode 100644
index 0000000..624787f
--- /dev/null
+++ b/patch/shifttag.h
@@ -0,0 +1 @@
+static void shifttag(const Arg *arg);