Skip to content

fix(sway/language): keep flag visible across hot-plug and unknown layouts#5039

Open
mil-ad wants to merge 1 commit into
Alexays:masterfrom
mil-ad:fix/sway-language-flag-disappears
Open

fix(sway/language): keep flag visible across hot-plug and unknown layouts#5039
mil-ad wants to merge 1 commit into
Alexays:masterfrom
mil-ad:fix/sway-language-flag-disappears

Conversation

@mil-ad
Copy link
Copy Markdown

@mil-ad mil-ad commented May 15, 2026

Fixes the sway/language module silently clearing its {flag} (and {short} /
{shortDescription} / {variant}) output until waybar is restarted.

Root cause

Two cooperating bugs in src/modules/sway/language.cpp:

Fix

  1. Guard set_current_layout with find() and early-return on miss, preserving the last known good layout_.
  2. Refresh layouts_map_ from onEvent on change == "added" || "xkb_keymap" via ipc_.sendCmd(IPC_GET_INPUTS).
  3. Make onCmd re-runnable — union layouts across every keyboard input and layouts_map_.clear() before each rebuild to avoid compounding the duplicate-suffix pass ("us""us1""us11").

sendCmd is synchronous and re-emits signal_cmd on the calling thread, so the refresh call is made after releasing mutex_ to avoid a self-deadlock when onCmd re-locks it.

…gged

devices) so transient events stop blanking layout_. Refresh layouts_map_
on "added"/"xkb_keymap" input events and union layouts across all
keyboards so new devices contribute their layouts. Release mutex_ before
the refresh sendCmd to avoid self-deadlock from the synchronous
signal_cmd emit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant