summaryrefslogtreecommitdiff
path: root/dwm/patch/switchcol.c
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwm/patch/switchcol.c
Diffstat (limited to 'dwm/patch/switchcol.c')
-rwxr-xr-xdwm/patch/switchcol.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/dwm/patch/switchcol.c b/dwm/patch/switchcol.c
new file mode 100755
index 0000000..6caf8ba
--- /dev/null
+++ b/dwm/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;
+ }
+ }
+}
+