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.
This commit is contained in:
Rutherther 2025-06-04 19:18:32 +02:00
parent faa56cc9b9
commit 99574c8041
No known key found for this signature in database
GPG Key ID: 858E0FD287A37612

2
dwl.c
View File

@ -2915,7 +2915,7 @@ updatemons(struct wl_listener *listener, void *data)
} }
if (selmon && selmon->wlr_output->enabled) { 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) if (!c->mon && client_surface(c)->mapped)
setmon(c, selmon, c->tags); setmon(c, selmon, c->tags);
} }