Skip to content

fix(linux): hide overlay before paste on GNOME Wayland#246

Open
wrt54gl wants to merge 1 commit intoOpenWhispr:mainfrom
wrt54gl:fix/gnome-wayland-autohide-paste
Open

fix(linux): hide overlay before paste on GNOME Wayland#246
wrt54gl wants to merge 1 commit intoOpenWhispr:mainfrom
wrt54gl:fix/gnome-wayland-autohide-paste

Conversation

@wrt54gl
Copy link
Contributor

@wrt54gl wrt54gl commented Feb 10, 2026

Summary

  • Fixes paste not working on GNOME Wayland when FLOATING_ICON_AUTO_HIDE is enabled
  • BrowserWindow.show() steals focus from the target window on GNOME Wayland, causing ydotool keystrokes to go to the OpenWhispr overlay instead of the user's app
  • Temporarily hides the overlay before pasting so GNOME returns focus to the target window, then re-shows if auto-hide is disabled
  • Restores AT-SPI2 terminal detection and GNOME-specific ydotool-first paste tool ordering removed in fix(linux): persistent clipboard ownership on Wayland — Ctrl+V works after transcription #221
  • Adds open-whispr to AT-SPI2 skip set so our own window is never misidentified as the paste target

Details

On GNOME Wayland, BrowserWindow.show() triggers activation via xdg_activation_v1, stealing keyboard focus. Since ydotool injects key events to the focused window (via uinput), the paste keystrokes (Ctrl+V / Ctrl+Shift+V) were sent to the overlay window instead of the terminal or other target application.

The fix adds a hide + 200ms delay before the paste operation in the paste-text IPC handler, allowing the GNOME compositor to return focus to the previously active window. After paste completes, the overlay is re-shown only if FLOATING_ICON_AUTO_HIDE is disabled.

This also restores two GNOME Wayland fixes from PR #202 that were removed in #221:

  • AT-SPI2 terminal detection: On GNOME Wayland, xdotool can only see XWayland windows and returns OpenWhispr's own window. AT-SPI2 reliably detects both native Wayland and XWayland active windows.
  • ydotool-first paste ordering: On GNOME Wayland, xdotool may silently target the wrong window while reporting success, preventing fallback to ydotool.

Test plan

  • Enable FLOATING_ICON_AUTO_HIDE on GNOME Wayland
  • Dictate text while focused in GNOME Terminal → should paste with Ctrl+Shift+V
  • Dictate text while focused in a non-terminal app (e.g. Text Editor) → should paste with Ctrl+V
  • Disable FLOATING_ICON_AUTO_HIDE → overlay should re-appear after paste
  • Verify no regression on X11 or non-GNOME Wayland compositors

🤖 Generated with Claude Code

…us steal

On GNOME Wayland with FLOATING_ICON_AUTO_HIDE enabled, BrowserWindow.show()
steals focus from the target window. Since ydotool sends keystrokes to the
focused window, this causes paste keystrokes to go to the OpenWhispr overlay
instead of the user's application (e.g. terminal).

Fix by temporarily hiding the overlay before pasting, allowing GNOME to
return focus to the target window. The overlay is re-shown after paste
if auto-hide is not enabled.

Also restores AT-SPI2 terminal detection and GNOME-specific ydotool-first
paste tool ordering that were removed in OpenWhispr#221, and adds 'open-whispr' to
the AT-SPI2 skip set as a safety net.

Co-Authored-By: Claude Opus 4.6 <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.

1 participant