From 99574c80412da1714666ba35baa23d7a2fce7384 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Wed, 4 Jun 2025 19:18:32 +0200 Subject: [PATCH] fix: keep focused client when readding clients from off output Fixes #1133. When a output is turned off, the clients go to another active output. When this is the last output, and the output is then reactivated in the future, the focus will be lost, because of the order the clients are iterated in. The focused client is first in the list, while the unfocused is last. This ensures the previously focused client is enumerated as last, making it the currently focused client. --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 4816159..a46dfa5 100644 --- a/dwl.c +++ b/dwl.c @@ -2915,7 +2915,7 @@ updatemons(struct wl_listener *listener, void *data) } if (selmon && selmon->wlr_output->enabled) { - wl_list_for_each(c, &clients, link) { + wl_list_for_each_reverse(c, &clients, link) { if (!c->mon && client_surface(c)->mapped) setmon(c, selmon, c->tags); }