sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 2061e695b297d9b575ac6fa34e31474b33a66ddc
parent fb9b31955a167a21ff7862599e63495e936a8886
Author: Jaye Shovelton <Beanie.github@proton.me>
Date:   Sun, 29 Nov 2026 17:31:53 +0000

[dwm][patch][spawnonemptytag] hotfix, ignore floating windows in search

apologies for all the commits, that should be all the bugs gone

Diffstat:
Mdwm.suckless.org/patches/spawnonemptytag/dwm-spawnonemptytag-6.8.diff | 90+++++++++++++++++++++----------------------------------------------------------
Mdwm.suckless.org/patches/spawnonemptytag/index.md | 4++--
2 files changed, 26 insertions(+), 68 deletions(-)

diff --git a/dwm.suckless.org/patches/spawnonemptytag/dwm-spawnonemptytag-6.8.diff b/dwm.suckless.org/patches/spawnonemptytag/dwm-spawnonemptytag-6.8.diff @@ -1,86 +1,44 @@ -From f76a4a25f2a4a2c3f96effb50ccee700c0c38542 Mon Sep 17 00:00:00 2001 +From f944f440791746eaaaab41664d1231d9ce45e4d5 Mon Sep 17 00:00:00 2001 From: Jaye Shovelton <Beanie.github@proton.me> -Date: Sun, 29 Nov 2026 16:55:23 +0000 +Date: Sun, 29 Nov 2026 17:28:58 +0000 Subject: [PATCH] Switch to the closest empty tag upon spawning a command --- - dwm.c | 35 ++++++++++++++++++++++++++++++----- - 1 file changed, 30 insertions(+), 5 deletions(-) + dwm.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) diff --git a/dwm.c b/dwm.c -index 53b393e..1ce967c 100644 +index 53b393e..2e4787e 100644 --- a/dwm.c +++ b/dwm.c -@@ -184,6 +184,7 @@ static void monocle(Monitor *m); - static void motionnotify(XEvent *e); - static void movemouse(const Arg *arg); - static Client *nexttiled(Client *c); -+static unsigned int occlusions(Monitor *m); - static void pop(Client *c); - static void propertynotify(XEvent *e); - static void quit(const Arg *arg); -@@ -307,6 +308,23 @@ applyrules(Client *c) +@@ -307,6 +307,27 @@ applyrules(Client *c) XFree(ch.res_class); if (ch.res_name) XFree(ch.res_name); + -+ /* find an empty tag */ -+ unsigned int occ = occlusions(c->mon); -+ unsigned int tagset = c->mon->tagset[c->mon->seltags]; -+ Arg ctag, tag; -+ ctag.ui = tagset & -tagset; /* get earliest tag in tagset */ -+ tag = ctag; -+ while (tag.ui & occ) { -+ unsigned int newtag = ((tag.ui << 1) & TAGMASK) | (tag.ui >> (LENGTH(tags) - 1)); -+ occ ^= tag.ui; -+ tag.ui = newtag; ++ if (!c->isfloating) { ++ /* find an empty tag */ ++ unsigned int occ = 0; ++ unsigned int tagset = c->mon->tagset[c->mon->seltags]; ++ Arg ctag, tag; ++ for(Client *ec = c->mon->clients; ec; ec = ec->next) ++ occ |= ec->tags == TAGMASK || ec->isfloating ? 0 : ec->tags; ++ ctag.ui = tagset & -tagset; /* get earliest tag in tagset */ ++ tag = ctag; ++ while (tag.ui & occ) { ++ unsigned int newtag = ((tag.ui << 1) & TAGMASK) | (tag.ui >> (LENGTH(tags) - 1)); ++ occ ^= tag.ui; ++ tag.ui = newtag; ++ } ++ if (tag.ui != ctag.ui) ++ /* NOTE: this uses selmon instead of c->mon, but it's assumed they're ++ the same */ ++ view(&tag); + } -+ if (tag.ui != ctag.ui && !c->isfloating) -+ /* NOTE: this uses selmon instead of c->mon, but it's assumed they're -+ the same */ -+ view(&tag); + c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; } -@@ -700,7 +718,7 @@ drawbar(Monitor *m) - int x, w, tw = 0; - int boxs = drw->fonts->h / 9; - int boxw = drw->fonts->h / 6 + 2; -- unsigned int i, occ = 0, urg = 0; -+ unsigned int i, occ = occlusions(m), urg = 0; - Client *c; - - if (!m->showbar) -@@ -713,10 +731,8 @@ drawbar(Monitor *m) - drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0); - } - -- for (c = m->clients; c; c = c->next) { -- occ |= c->tags; -- if (c->isurgent) -- urg |= c->tags; -+ for (c = m->clients; c && c->isurgent; c = c->next) { -+ urg |= c->tags; - } - x = 0; - for (i = 0; i < LENGTH(tags); i++) { -@@ -1209,6 +1225,15 @@ nexttiled(Client *c) - return c; - } - -+unsigned int -+occlusions(Monitor *m) -+{ -+ unsigned int occ = 0; -+ for(Client *c = m->clients; c; c = c->next) -+ occ |= c->tags == TAGMASK ? 0 : c->tags; -+ return occ; -+} -+ - void - pop(Client *c) - { -- 2.56.1 diff --git a/dwm.suckless.org/patches/spawnonemptytag/index.md b/dwm.suckless.org/patches/spawnonemptytag/index.md @@ -4,8 +4,8 @@ spawnonemptytag Description ----------- When a non-floating window is spawned, 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. +tag on the right, ignoring floating winows. 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 --------