Skip to content

fix(linux): stop overlay focus theft on wlroots (Sway)#1026

Open
sochotnicky wants to merge 1 commit into
OpenWhispr:mainfrom
sochotnicky:wayland-preview-nofocus
Open

fix(linux): stop overlay focus theft on wlroots (Sway)#1026
sochotnicky wants to merge 1 commit into
OpenWhispr:mainfrom
sochotnicky:wayland-preview-nofocus

Conversation

@sochotnicky

Copy link
Copy Markdown

On wlroots compositors the dictation/preview/notification overlays steal focus on map. Root cause: the overlays are created focusable:false, which makes Electron map them as override-redirect XWayland windows. wlroots' XWayland focuses override-redirect windows on map unless their _NET_WM_WINDOW_TYPE is in its no-focus set (notification/tooltip/utility/splash/menus) — and the overlays are TOOLBAR/NORMAL, which are not. Mutter/KWin honor focusable:false directly, so GNOME/KDE never had the bug; forcing XWayland (the prior fix) doesn't help here because it's already XWayland.

Map the non-interactive overlays (dictation mic, transcription preview, meeting notification) as type "notification" on wlroots, which is in wlroots' no-focus set — clicks still work, keyboard focus isn't grabbed. GNOME/KDE keep their existing types (no regression). The agent overlay is left focus-capable since it needs keyboard input for chat.

Verified against xprop on Sway: preview was override-redirect + TOOLBAR (focus stolen); no_focus rules and get_tree don't apply to override-redirect windows.

Fixes the focus stealing on Sway for me at least and should fix #719

…on type

On wlroots compositors the dictation/preview/notification overlays steal focus
on map. Root cause: the overlays are created focusable:false, which makes Electron
map them as override-redirect XWayland windows. wlroots' XWayland focuses
override-redirect windows on map unless their _NET_WM_WINDOW_TYPE is in its
no-focus set (notification/tooltip/utility/splash/menus) — and the overlays are
TOOLBAR/NORMAL, which are not. Mutter/KWin honor focusable:false directly, so
GNOME/KDE never had the bug; forcing XWayland (the prior fix) doesn't help here
because it's already XWayland.

Map the non-interactive overlays (dictation mic, transcription preview, meeting
notification) as type "notification" on wlroots, which is in wlroots' no-focus
set — clicks still work, keyboard focus isn't grabbed. GNOME/KDE keep their
existing types (no regression). The agent overlay is left focus-capable since it
needs keyboard input for chat.

Verified against xprop on Sway: preview was override-redirect + TOOLBAR (focus
stolen); no_focus rules and get_tree don't apply to override-redirect windows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Feature: Voice recording icon should not steal focus

1 participant