summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2022-07-04 13:07:36 +0200
committerbakkeby <[email protected]>2022-07-04 13:07:36 +0200
commit279c571986a8c9b22acf4fe462e3d1470bf2925e (patch)
treeda80a75bce27b20a060bfe9b619342e351192f69 /patch
parenta15a25992646856066e986d070be5aa6a28e9d2b (diff)
downloaddwm-flexipatch-279c571986a8c9b22acf4fe462e3d1470bf2925e.tar.gz
dwm-flexipatch-279c571986a8c9b22acf4fe462e3d1470bf2925e.zip
Adding shifttagclients patch ref. #270
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/shifttagclients.c49
-rw-r--r--patch/shifttagclients.h1
-rw-r--r--patch/shiftviewclients.c3
5 files changed, 58 insertions, 1 deletions
diff --git a/patch/include.c b/patch/include.c
index 20ac9df..2af5433 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -235,6 +235,9 @@
#if SHIFTTAG_PATCH
#include "shifttag.c"
#endif
+#if SHIFTTAGCLIENTS_PATCH
+#include "shifttagclients.c"
+#endif
#if SHIFTVIEW_PATCH
#include "shiftview.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 6806b59..eb6b58f 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -237,6 +237,9 @@
#if SHIFTTAG_PATCH
#include "shifttag.h"
#endif
+#if SHIFTTAGCLIENTS_PATCH
+#include "shifttagclients.h"
+#endif
#if SHIFTVIEW_PATCH
#include "shiftview.h"
#endif
diff --git a/patch/shifttagclients.c b/patch/shifttagclients.c
new file mode 100644
index 0000000..e8da31d
--- /dev/null
+++ b/patch/shifttagclients.c
@@ -0,0 +1,49 @@
+/* Sends a window to the next/prev tag that has a client, else it moves it to the next/prev one. */
+void
+shifttagclients(const Arg *arg)
+{
+ Arg shifted;
+ Client *c;
+ unsigned int tagmask = 0;
+
+ #if TAGSYNC_PATCH
+ Monitor *origselmon = selmon;
+ for (selmon = mons; selmon; selmon = selmon->next)
+ #endif // TAGSYNC_PATCH
+ for (c = selmon->clients; c; c = c->next) {
+ if (c == selmon->sel)
+ continue;
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ if (!(c->tags & SPTAGMASK))
+ tagmask = tagmask | c->tags;
+ #elif SCRATCHPAD_ALT_1_PATCH
+ if (!(c->tags & SCRATCHPAD_MASK))
+ tagmask = tagmask | c->tags;
+ #else
+ tagmask = tagmask | c->tags;
+ #endif // SCRATCHPADS_PATCH
+ }
+ #if TAGSYNC_PATCH
+ selmon = origselmon;
+ #endif // TAGSYNC_PATCH
+
+ #if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
+ shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
+ #else
+ shifted.ui = selmon->tagset[selmon->seltags];
+ #endif // SCRATCHPADS_PATCH
+
+ do {
+ 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
+ } while (tagmask && !(shifted.ui & tagmask));
+
+ tag(&shifted);
+}
diff --git a/patch/shifttagclients.h b/patch/shifttagclients.h
new file mode 100644
index 0000000..43049a0
--- /dev/null
+++ b/patch/shifttagclients.h
@@ -0,0 +1 @@
+static void shifttagclients(const Arg *arg);
diff --git a/patch/shiftviewclients.c b/patch/shiftviewclients.c
index 5755e7c..f64f42b 100644
--- a/patch/shiftviewclients.c
+++ b/patch/shiftviewclients.c
@@ -10,6 +10,8 @@ shiftviewclients(const Arg *arg)
for (selmon = mons; selmon; selmon = selmon->next)
#endif // TAGSYNC_PATCH
for (c = selmon->clients; c; c = c->next) {
+ if (c == selmon->sel)
+ continue;
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
if (!(c->tags & SPTAGMASK))
tagmask = tagmask | c->tags;
@@ -44,4 +46,3 @@ shiftviewclients(const Arg *arg)
view(&shifted);
}
-