summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
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