fix(linux): Clipboard paste methods (ctrl_v / ctrl_shift_v / shift_insert) fail on GNOME Wayland#1276
Open
mrinterweb wants to merge 1 commit intocjpais:mainfrom
Open
Conversation
wtype relies on the zwp_virtual_keyboard_manager_v1 Wayland protocol, which Mutter (GNOME) deliberately does not implement — the same reason wtype is already skipped on KDE. On GNOME Wayland, Handy's key-combo dispatch in try_send_key_combo_linux picked wtype first (because !is_kde_wayland() and wtype is typically installed), then propagated the wtype failure via `?`, preventing the cascade from falling through to dotool/ydotool. This broke the ctrl_v, ctrl_shift_v, and shift_insert paste methods entirely on GNOME Wayland. Add is_gnome() and is_gnome_wayland() helpers in utils.rs mirroring the existing KDE detection, and extend the wtype guards in try_send_key_combo_linux and try_direct_typing_linux to skip wtype on GNOME the same way they skip it on KDE. With this change, the cascade on GNOME Wayland falls through to dotool → ydotool, both of which work correctly since they bypass the virtual-keyboard protocol (dotool uses the RemoteDesktop portal; ydotool uses /dev/uinput). Verified locally on CachyOS + GNOME Wayland (Mutter): paste_method "ctrl_shift_v" now logs "Using ydotool for key combo" and pastes in ~120 ms, down from a hard wtype error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
I'll take a look soonish, probably will be pulled in after I review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #429
What
Adds
is_gnome()andis_gnome_wayland()helpers inutils.rsand extends the wtype guards intry_send_key_combo_linuxandtry_direct_typing_linuxto skip wtype on GNOME the same way it's already skipped on KDE.Why
I was also encountering this issue. Direct input worked with the remote desktop app in gnome, but it was terribly slow.
Mutter (GNOME's compositor) deliberately doesn't implement
zwp_virtual_keyboard_manager_v1, the same protocolwtyperelies on, and the same reason the existing code skips wtype on KDE. On GNOME Wayland, Handy's key-combo dispatch was picking wtype first, failing, and propagating the error instead of falling through to dotool/ydotool, which broke thectrl_v,ctrl_shift_v, andshift_insertpaste methods entirely.This addresses the clipboard paste portion of #429. The broader Direct mode/enigo issues discussed in that thread (dropped capital letters, input-method-v2 support) remain separate.
How
Minimal, targeted change that mirrors the existing KDE detection pattern. No new dependencies, no behavior changes for KDE/X11/macOS/Windows.
Before Submitting This PR
Related Issues/Discussions
Related to #429 — this addresses the clipboard paste portion (ctrl_v, ctrl_shift_v, shift_insert failing on GNOME Wayland). The broader Direct mode/enigo issues discussed in that thread remain separate.
Testing
Verified locally on CachyOS + GNOME Wayland (Mutter):
Using wtype for key combo→wtype failed: Compositor does not support the virtual keyboard protocol— clipboard paste methods fail entirely, falling back to enigo's RemoteDesktop portal path (~40ms/keystroke)Also tested direct typing still works correctly (falls through to enigo's portal path, same as before). No regression observed on KDE/X11 paths (guard logic unchanged for those).
Screenshots/Videos
This is how I have it configured, and the text insertion is instant.
Kooha-2026-04-12-03-06-50.mp4
AI Assistance
No AI was used in this PR
AI was used (please describe below)
Tools used: Claude Code (Claude Opus)
How extensively: AI assisted with identifying the root cause, writing the code changes, and drafting the PR description. The fix mirrors the existing KDE detection pattern already in the codebase. Testing and validation were done by a human on a real GNOME Wayland system.