summaryrefslogtreecommitdiffhomepage
path: root/patch/focusadjacenttag.c
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/focusadjacenttag.c
parent0a23ed6efdee28bcdd3c9f69381cdf499f7c86e7 (diff)
downloaddwm-flexipatch-1f21ed72d14af33fb490c14fcf809fe0606fadb0.tar.gz
dwm-flexipatch-1f21ed72d14af33fb490c14fcf809fe0606fadb0.zip
Adding focusadjacenttag patch
Diffstat (limited to 'patch/focusadjacenttag.c')
-rw-r--r--patch/focusadjacenttag.c73
1 files changed, 73 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