commit d2ddb7cbb7fd4b0854470bed35381dca13cfead6
parent d42f88065db1a508c202091071cc1ad021cfa6ce
Author: Jaye Shovelton <Beanie.github@proton.me>
Date: Sun, 29 Nov 2026 04:24:51 +0000
[dwm][patch][spawnonemptytag] Switch to the closest empty tag upon spawning a command
Diffstat:
4 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/dwm.suckless.org/patches/borderrule/dwm-borderrule-20231226-e7f651b.diff b/dwm.suckless.org/patches/borderrule/dwm-borderrule-20231226-e7f651b.diff
@@ -1,5 +1,5 @@
From e7f651b1321747fb92521522f0aa07a01160d4af Mon Sep 17 00:00:00 2001
-From: Jasper Shovelton <Beanie.github@proton.me>
+From: Jaye Shovelton <Beanie.github@proton.me>
Date: Tue, 26 Dec 2023 12:57:35 +0000
Subject: [PATCH] Add a `borderpx` value to `rules` in `config.def.h`.
diff --git a/dwm.suckless.org/patches/borderrule/index.md b/dwm.suckless.org/patches/borderrule/index.md
@@ -11,4 +11,4 @@ Download
Authors
-------
-* Jasper Shovelton - <jaspershovelton@proton.me>
+* Jaye Shovelton - <Beanie.github@proton.me>
diff --git a/dwm.suckless.org/patches/spawnonemptytag/dwm-spawnonemptytag-6.8.diff b/dwm.suckless.org/patches/spawnonemptytag/dwm-spawnonemptytag-6.8.diff
@@ -0,0 +1,44 @@
+From 0fa0d740bb6507946b4581ac3c52e06e1c3cb29e Mon Sep 17 00:00:00 2001
+From: Jaye Shovelton <Beanie.github@proton.me>
+Date: Sun, 29 Nov 2026 03:51:26 +0000
+Subject: [PATCH] Switch to the closest empty tag upon spawning a command
+
+---
+ dwm.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/dwm.c b/dwm.c
+index 53b393e..346402f 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -1651,6 +1651,27 @@ spawn(const Arg *arg)
+
+ if (arg->v == dmenucmd)
+ dmenumon[0] = '0' + selmon->num;
++ else {
++ unsigned int occ = 0;
++ unsigned int tagset = selmon->tagset[selmon->seltags];
++ Arg ct, t;
++
++ for(Client *c = selmon->clients; c; c=c->next)
++ occ |= c->tags == TAGMASK ? 0 : c->tags;
++ /* get earliest tag in tagset */
++ ct.ui = tagset & -tagset;
++ t = ct;
++
++ while (t.ui & occ) {
++ unsigned int newt = ((t.ui << 1) & TAGMASK) | (t.ui >> (LENGTH(tags) - 1));
++ occ ^= t.ui;
++ t.ui = newt;
++ }
++
++ if (t.ui != ct.ui)
++ view(&t);
++ }
++
+ if (fork() == 0) {
+ if (dpy)
+ close(ConnectionNumber(dpy));
+--
+2.56.1
+
diff --git a/dwm.suckless.org/patches/spawnonemptytag/index.md b/dwm.suckless.org/patches/spawnonemptytag/index.md
@@ -0,0 +1,16 @@
+spawnonemptytag
+===============
+
+Description
+-----------
+When a binding executes `spawn`, this patch switches to the closest empty tag
+on the right. It wraps round if there are no more tags and does nothing if the
+current tag is empty or there are no empty tags.
+
+Download
+--------
+* [dwm-spawnonemptytag-6.8.diff](dwm-spawnonemptytag-6.8.diff)
+
+Authors
+-------
+* Jaye Shovelton - <Beanie.github@proton.me>