summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorbakkeby <[email protected]>2019-10-04 00:20:47 +0200
committerbakkeby <[email protected]>2019-10-04 00:20:47 +0200
commit853c64fbb7adf09743af0723c6f2a55e83451c99 (patch)
tree3384de55ef44256d32ccd97b613b75729c5e7001 /patch
parent40000bba1ce137d426a3844d2a10e2e646c7ea82 (diff)
downloaddwm-flexipatch-853c64fbb7adf09743af0723c6f2a55e83451c99.tar.gz
dwm-flexipatch-853c64fbb7adf09743af0723c6f2a55e83451c99.zip
Adding switchcol patch
Diffstat (limited to 'patch')
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patch/switchcol.c28
-rw-r--r--patch/switchcol.h1
4 files changed, 37 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c
index cd52548..ca231a0 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -86,6 +86,10 @@
#include "systray.c"
#endif
+#if SWITCHCOL_PATCH
+#include "switchcol.c"
+#endif
+
#if TAGALLMON_PATCH
#include "tagallmon.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index ca2940a..2522376 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -86,6 +86,10 @@
#include "systray.h"
#endif
+#if SWITCHCOL_PATCH
+#include "switchcol.h"
+#endif
+
#if TAGALLMON_PATCH
#include "tagallmon.h"
#endif
diff --git a/patch/switchcol.c b/patch/switchcol.c
new file mode 100644
index 0000000..b2fe595
--- /dev/null
+++ b/patch/switchcol.c
@@ -0,0 +1,28 @@
+void
+switchcol(const Arg *arg)
+{
+ Client *c, *t;
+ int col = 0;
+ int i;
+
+ if (!selmon->sel)
+ return;
+ for (i = 0, c = nexttiled(selmon->clients); c ;
+ c = nexttiled(c->next), i++) {
+ if (c == selmon->sel)
+ col = (i + 1) > selmon->nmaster;
+ }
+ if (i <= selmon->nmaster)
+ return;
+ for (c = selmon->stack; c; c = c->snext) {
+ if (!ISVISIBLE(c))
+ continue;
+ for (i = 0, t = nexttiled(selmon->clients); t && t != c;
+ t = nexttiled(t->next), i++);
+ if (t && (i + 1 > selmon->nmaster) != col) {
+ focus(c);
+ restack(selmon);
+ break;
+ }
+ }
+} \ No newline at end of file
diff --git a/patch/switchcol.h b/patch/switchcol.h
new file mode 100644
index 0000000..f7f5f96
--- /dev/null
+++ b/patch/switchcol.h
@@ -0,0 +1 @@
+static void switchcol(const Arg *arg); \ No newline at end of file