Skip to content

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
mrinterweb:fix/gnome-wayland-clipboard-paste
Open

fix(linux): Clipboard paste methods (ctrl_v / ctrl_shift_v / shift_insert) fail on GNOME Wayland#1276
mrinterweb wants to merge 1 commit intocjpais:mainfrom
mrinterweb:fix/gnome-wayland-clipboard-paste

Conversation

@mrinterweb
Copy link
Copy Markdown

@mrinterweb mrinterweb commented Apr 11, 2026

Related to #429

What

Adds is_gnome() and is_gnome_wayland() helpers in utils.rs and extends the wtype guards in try_send_key_combo_linux and try_direct_typing_linux to 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 protocol wtype relies 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 the ctrl_v, ctrl_shift_v, and shift_insert paste 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):

  • Before: Using wtype for key combowtype failed: Compositor does not support the virtual keyboard protocol — clipboard paste methods fail entirely, falling back to enigo's RemoteDesktop portal path (~40ms/keystroke)
  • After: wtype is skipped, cascade falls through to ydotool which sends the paste key combo. Text pasted successfully via clipboard with no errors.

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
Screenshot From 2026-04-12 02-43-04

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.

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>
@mrinterweb mrinterweb marked this pull request as ready for review April 12, 2026 10:10
@mrinterweb mrinterweb changed the title Clipboard paste methods (ctrl_v / ctrl_shift_v / shift_insert) fail on GNOME Wayland fix(linux): Clipboard paste methods (ctrl_v / ctrl_shift_v / shift_insert) fail on GNOME Wayland Apr 12, 2026
@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Apr 12, 2026

I'll take a look soonish, probably will be pulled in after I review

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.

2 participants