From a14d6da36f1a77cd73daf751828224dd407e78f9 Mon Sep 17 00:00:00 2001 From: wochap Date: Wed, 6 Mar 2024 15:20:45 -0500 Subject: [PATCH] fix: edge case where there are more than 1 window with the same scratchkey --- dwl.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index e179940..4c40f86 100644 --- a/dwl.c +++ b/dwl.c @@ -2534,18 +2534,26 @@ focusortogglematchingscratch(const Arg *arg) { Client *c; unsigned int found = 0; + unsigned int hide = 0; wl_list_for_each(c, &clients, link) { if (c->scratchkey == 0) { continue; } if (c->scratchkey == ((char**)arg->v)[0][0]) { - found = 1; if (VISIBLEON(c, selmon)) { + if (found == 1) { + if (hide == 1) { + c->tags = 0; + focusclient(focustop(selmon), 1); + } + continue; + } if (focustop(selmon) == c) { // hide c->tags = 0; focusclient(focustop(selmon), 1); + hide = 1; } else { // focus focusclient(c, 1); @@ -2556,6 +2564,7 @@ focusortogglematchingscratch(const Arg *arg) // focus focusclient(c, 1); } + found = 1; continue; } if (VISIBLEON(c, selmon)) { -- 2.48.1