summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-10-02 23:57:25 +0200
committerbakkeby <[email protected]>2019-10-02 23:57:25 +0200
commit1f21ed72d14af33fb490c14fcf809fe0606fadb0 (patch)
tree65c31f1354fe4607699c32f1bd25abfce6a8f8f8 /patch
parent0a23ed6efdee28bcdd3c9f69381cdf499f7c86e7 (diff)
downloaddwm-flexipatch-1f21ed72d14af33fb490c14fcf809fe0606fadb0.tar.gz
dwm-flexipatch-1f21ed72d14af33fb490c14fcf809fe0606fadb0.zip
Adding focusadjacenttag patch
Diffstat (limited to 'patch')
-rw-r--r--patch/focusadjacenttag.c73
-rw-r--r--patch/focusadjacenttag.h6
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
4 files changed, 87 insertions, 0 deletions
diff --git a/patch/focusadjacenttag.c b/patch/focusadjacenttag.c
new file mode 100644
index 0000000..5b13b54
--- /dev/null
+++ b/patch/focusadjacenttag.c
@@ -0,0 +1,73 @@
+void
+tagtoleft(const Arg *arg)
+{
+ if (selmon->sel != NULL
+ && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->sel->tags >>= 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+tagtoright(const Arg *arg)
+{
+ if (selmon->sel != NULL
+ && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->sel->tags <<= 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+viewtoleft(const Arg *arg)
+{
+ if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+viewtoright(const Arg *arg)
+{
+ if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+tagandviewtoleft(const Arg *arg)
+{
+ if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->sel->tags >>= 1;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
+ focus(selmon->sel);
+ arrange(selmon);
+ }
+}
+
+void
+tagandviewtoright(const Arg *arg)
+{
+ if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->sel->tags <<= 1;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
+ focus(selmon->sel);
+ arrange(selmon);
+ }
+} \ No newline at end of file
diff --git a/patch/focusadjacenttag.h b/patch/focusadjacenttag.h
new file mode 100644
index 0000000..55b1019
--- /dev/null
+++ b/patch/focusadjacenttag.h
@@ -0,0 +1,6 @@
+static void tagtoleft(const Arg *arg);
+static void tagtoright(const Arg *arg);
+static void viewtoleft(const Arg *arg);
+static void viewtoright(const Arg *arg);
+static void tagandviewtoleft(const Arg *arg);
+static void tagandviewtoright(const Arg *arg); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index 920f7ff..82b151b 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -36,6 +36,10 @@
#include "ewmhtags.c"
#endif
+#if FOCUSADJACENTTAG_PATCH
+#include "focusadjacenttag.c"
+#endif
+
#if FULLSCREEN_PATCH
#include "fullscreen.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 67578c7..74b5404 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -36,6 +36,10 @@
#include "ewmhtags.h"
#endif
+#if FOCUSADJACENTTAG_PATCH
+#include "focusadjacenttag.h"
+#endif
+
#if FULLSCREEN_PATCH
#include "fullscreen.h"
#endif