summaryrefslogtreecommitdiff
path: root/patch/switchcol.c
diff options
context:
space:
mode:
authorBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
committerBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
commit69262b01ced79c2d776fab9b889926d1816a1e7a (patch)
treef304cd6fa8734e83a7772d07dc9b484781565155 /patch/switchcol.c
Added DWM
Diffstat (limited to 'patch/switchcol.c')
-rw-r--r--patch/switchcol.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/patch/switchcol.c b/patch/switchcol.c
new file mode 100644
index 0000000..6caf8ba
--- /dev/null
+++ b/patch/switchcol.c
@@ -0,0 +1,29 @@
+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;
+ }
+ }
+}
+