Skip to content

fix(wayland): initialise Enigo, and tolerate failure#1337

Open
LukeCarrier wants to merge 2 commits into
cjpais:mainfrom
LukeCarrier:fix-wayland-enigo-woes
Open

fix(wayland): initialise Enigo, and tolerate failure#1337
LukeCarrier wants to merge 2 commits into
cjpais:mainfrom
LukeCarrier:fix-wayland-enigo-woes

Conversation

@LukeCarrier
Copy link
Copy Markdown

@LukeCarrier LukeCarrier commented Apr 27, 2026

Enable the enigo crate's wayland feature. Without it, despite WAYLAND_DISPLAY being set, Enigo tries only its x11rb backend rather than wayland:

[2026-04-27][09:29:56][enigo][DEBUG] using default settings
[2026-04-27][09:29:56][enigo::platform][DEBUG] trying to establish a x11 connection to $DISPLAY
[2026-04-27][09:29:56][enigo::platform::x11][DEBUG] using x11rb
[2026-04-27][09:29:56][enigo::platform::x11][ERROR] DisplayParsingError(DisplayNotSet)
[2026-04-27][09:29:56][enigo::platform][WARN] failed to establish x11 connection: no connection could be established: (failed to establish the connection)
[2026-04-27][09:29:56][enigo::platform][ERROR] no successful connection
In this configuration Enigo will try both the `x11rb` and `wayland` backends, but only the `wayland` one will succeed:
[2026-04-27][09:44:52][enigo][DEBUG] using default settings
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] trying to establish a connection to $WAYLAND_DISPLAY
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_compositor (name: 1, version: 6)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_subcompositor (name: 2, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: xdg_wm_base (name: 3, version: 7)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_decoration_manager_v1 (name: 4, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: org_kde_kwin_server_decoration_manager (name: 5, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_layer_shell_v1 (name: 6, version: 5)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_session_lock_manager_v1 (name: 7, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_shm (name: 8, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_output_manager_v1 (name: 9, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_fractional_scale_manager_v1 (name: 10, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_tablet_manager_v2 (name: 11, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_pointer_gestures_v1 (name: 12, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_relative_pointer_manager_v1 (name: 13, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_pointer_constraints_v1 (name: 14, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_idle_notifier_v1 (name: 15, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_idle_inhibit_manager_v1 (name: 16, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_data_device_manager (name: 17, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_data_control_manager_v1 (name: 19, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_data_control_manager_v1 (name: 20, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_presentation (name: 21, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_security_context_manager_v1 (name: 22, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_text_input_manager_v3 (name: 23, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_input_method_manager_v2 (name: 24, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_keyboard_shortcuts_inhibit_manager_v1 (name: 25, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_virtual_keyboard_manager_v1 (name: 26, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_virtual_pointer_manager_v1 (name: 27, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_foreign_toplevel_list_v1 (name: 28, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_foreign_toplevel_manager_v1 (name: 29, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_workspace_manager_v1 (name: 30, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_output_manager_v1 (name: 31, version: 4)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_screencopy_manager_v1 (name: 32, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_viewporter (name: 33, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_background_effect_manager_v1 (name: 34, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_exporter_v2 (name: 35, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_importer_v2 (name: 36, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_gamma_control_manager_v1 (name: 37, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: xdg_activation_v1 (name: 38, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: mutter_x11_interop (name: 39, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_seat (name: 40, version: 9)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_cursor_shape_manager_v1 (name: 41, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_linux_dmabuf_v1 (name: 42, version: 5)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_drm_lease_device_v1 (name: 43, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_output (name: 44, version: 4)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlSeat received event: Capabilities { capabilities: Value(Capability(Pointer | Keyboard)) }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlOutput received event: Geometry { x: 0, y: 0, physical_width: 290, physical_height: 190, subpixel: Value(Unknown), make: "BOE", model: "NE135A1M-NY1", transform: Value(Normal) }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlOutput received event: Mode { flags: Value(Mode(Current | Preferred)), width: 2880, height: 1920, refresh: 120000 }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlKeyboard received event: wl_keyboard::Event::Keymap { Value(XkbV1), OwnedFd { fd: 54 }, 35356 }
[2026-04-27][09:44:52][enigo::platform::keymap2][DEBUG] creating new xkb:Keymap
[2026-04-27][09:44:52][enigo::platform::keymap2][DEBUG] new(format: 1, size: 35356, ...)
[2026-04-27][09:44:52][enigo::platform::keymap2][DEBUG] removed NULL byte at the end
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlKeyboard received irrelevant event: RepeatInfo { rate: 25, delay: 600 }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] ZwpInputMethodV2 received event: zwp_input_method_v2::Event::Done
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] update_keymap(&mut self)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] wait for response after keymap call
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] protocols available
virtual_keyboard: true
input_method: true
virtual_pointer: true
[2026-04-27][09:44:52][enigo::platform][DEBUG] wayland connection established
[2026-04-27][09:44:52][enigo::platform][DEBUG] trying to establish a x11 connection to $DISPLAY
[2026-04-27][09:44:52][enigo::platform::x11][DEBUG] using x11rb
[2026-04-27][09:44:52][enigo::platform::x11][ERROR] DisplayParsingError(DisplayNotSet)
[2026-04-27][09:44:52][enigo::platform][WARN] failed to establish x11 connection: no connection could be established: (failed to establish the connection)
[2026-04-27][09:44:52][handy_app_lib::commands][INFO] Enigo initialized successfully after permission grant

Enigo is used as a fallback, but prior to this change, if it failed to initialise paste() would never invoke the primary paste method. Instead the following logs would be observed:

[2026-04-26][23:56:08][handy_app_lib::clipboard][INFO] Using paste method: Direct, delay: 60ms
[2026-04-26][23:56:08][handy_app_lib::clipboard][ERROR] Enigo state not initialized
[2026-04-26][23:56:08][handy_app_lib::actions][ERROR] Failed to paste transcription: Enigo state not initialized

...since paste()'s call to AppHandle::try_state() would return an error which would be propagated up, causing an early exit.

Before Submitting This PR

Please confirm you have done the following:

If this is a feature or change that was previously closed/rejected:

  • I have explained in the description below why this should be reconsidered
  • I have gathered community feedback (link to discussion below)

Human Written Description

Enigo is used as a fallback, but prior to this change, if it failed to initialise paste() would never invoke the primary paste method. Instead the following logs would be observed:

[2026-04-26][23:56:08][handy_app_lib::clipboard][INFO] Using paste method: Direct, delay: 60ms
[2026-04-26][23:56:08][handy_app_lib::clipboard][ERROR] Enigo state not initialized
[2026-04-26][23:56:08][handy_app_lib::actions][ERROR] Failed to paste transcription: Enigo state not initialized

...since paste()'s call to AppHandle::try_state() would return an error which would be propagated up, causing an early exit.

Happy to switch to doing early returns rather than if let Some(x)s if you prefer, as it would reduce the size of the diff, but I thought it made the code easier to read.

Related Issues/Discussions

Fixes #
Discussion:

Community Feedback

Testing

Screenshots/Videos (if applicable)

AI Assistance

  • No AI was used in this PR
  • AI was used (please describe below)

If AI was used:

  • Tools used: Claude Haiku 4.5 via Goose
  • How extensively: moderate -- I had sprinked some logging calls around to confirm that the issue was with paste() propagating that error, but figuring out the correct fix for the mutex took a bit of back and forth.

Enigo is used as a fallback, but prior to this change, if it failed to
initialise paste() would never invoke the primary paste method. Instead
the following logs would be observed:

    [2026-04-26][23:56:08][handy_app_lib::clipboard][INFO] Using paste method: Direct, delay: 60ms
    [2026-04-26][23:56:08][handy_app_lib::clipboard][ERROR] Enigo state not initialized
    [2026-04-26][23:56:08][handy_app_lib::actions][ERROR] Failed to paste transcription: Enigo state not initialized

...since paste()'s call to AppHandle::try_state() would return an error
which would be propagated up, causing an early exit.
@LukeCarrier LukeCarrier marked this pull request as ready for review April 27, 2026 00:49
@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Apr 27, 2026

Only question I have is, do we have a clear reason why Enigo is failing to initialize? Is there an upstream bug that can be fixed?

I think we probably should tolerate a failure like you have, but I would prefer to fix upstream as well if possible.

What I mean by upstream in this case, is something in the code not initializing Enigo when it should? Or is it a true failure and why is it failing?

@blockedby
Copy link
Copy Markdown

sorry,+ 1 to ones who expecting problems with "paste" on wayland/kubuntu_lts_24.04 right now

@LukeCarrier
Copy link
Copy Markdown
Author

LukeCarrier commented Apr 27, 2026

Looks like it's trying to use its x11rb backend rather than wayland:

[2026-04-27][09:29:56][enigo][DEBUG] using default settings
[2026-04-27][09:29:56][enigo::platform][DEBUG] trying to establish a x11 connection to $DISPLAY
[2026-04-27][09:29:56][enigo::platform::x11][DEBUG] using x11rb
[2026-04-27][09:29:56][enigo::platform::x11][ERROR] DisplayParsingError(DisplayNotSet)
[2026-04-27][09:29:56][enigo::platform][WARN] failed to establish x11 connection: no connection could be established: (failed to establish the connection)
[2026-04-27][09:29:56][enigo::platform][ERROR] no successful connection

After enabling the crate's wayland feature (which doesn't appear to be enabled by default) it appears to still try the x11 path but successfully initialises the wayland one:

[2026-04-27][09:44:52][enigo][DEBUG] using default settings
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] trying to establish a connection to $WAYLAND_DISPLAY
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_compositor (name: 1, version: 6)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_subcompositor (name: 2, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: xdg_wm_base (name: 3, version: 7)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_decoration_manager_v1 (name: 4, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: org_kde_kwin_server_decoration_manager (name: 5, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_layer_shell_v1 (name: 6, version: 5)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_session_lock_manager_v1 (name: 7, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_shm (name: 8, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_output_manager_v1 (name: 9, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_fractional_scale_manager_v1 (name: 10, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_tablet_manager_v2 (name: 11, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_pointer_gestures_v1 (name: 12, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_relative_pointer_manager_v1 (name: 13, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_pointer_constraints_v1 (name: 14, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_idle_notifier_v1 (name: 15, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_idle_inhibit_manager_v1 (name: 16, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_data_device_manager (name: 17, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_data_control_manager_v1 (name: 19, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_data_control_manager_v1 (name: 20, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_presentation (name: 21, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_security_context_manager_v1 (name: 22, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_text_input_manager_v3 (name: 23, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_input_method_manager_v2 (name: 24, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_keyboard_shortcuts_inhibit_manager_v1 (name: 25, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_virtual_keyboard_manager_v1 (name: 26, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_virtual_pointer_manager_v1 (name: 27, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_foreign_toplevel_list_v1 (name: 28, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_foreign_toplevel_manager_v1 (name: 29, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_workspace_manager_v1 (name: 30, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_output_manager_v1 (name: 31, version: 4)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_screencopy_manager_v1 (name: 32, version: 3)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_viewporter (name: 33, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: ext_background_effect_manager_v1 (name: 34, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_exporter_v2 (name: 35, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zxdg_importer_v2 (name: 36, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwlr_gamma_control_manager_v1 (name: 37, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: xdg_activation_v1 (name: 38, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: mutter_x11_interop (name: 39, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_seat (name: 40, version: 9)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_cursor_shape_manager_v1 (name: 41, version: 2)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: zwp_linux_dmabuf_v1 (name: 42, version: 5)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wp_drm_lease_device_v1 (name: 43, version: 1)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] Global announced: wl_output (name: 44, version: 4)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlSeat received event: Capabilities { capabilities: Value(Capability(Pointer | Keyboard)) }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlOutput received event: Geometry { x: 0, y: 0, physical_width: 290, physical_height: 190, subpixel: Value(Unknown), make: "BOE", model: "NE135A1M-NY1", transform: Value(Normal) }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlOutput received event: Mode { flags: Value(Mode(Current | Preferred)), width: 2880, height: 1920, refresh: 120000 }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlKeyboard received event: wl_keyboard::Event::Keymap { Value(XkbV1), OwnedFd { fd: 54 }, 35356 }
[2026-04-27][09:44:52][enigo::platform::keymap2][DEBUG] creating new xkb:Keymap
[2026-04-27][09:44:52][enigo::platform::keymap2][DEBUG] new(format: 1, size: 35356, ...)
[2026-04-27][09:44:52][enigo::platform::keymap2][DEBUG] removed NULL byte at the end
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] WlKeyboard received irrelevant event: RepeatInfo { rate: 25, delay: 600 }
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] ZwpInputMethodV2 received event: zwp_input_method_v2::Event::Done
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] update_keymap(&mut self)
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] wait for response after keymap call
[2026-04-27][09:44:52][enigo::platform::wayland][DEBUG] protocols available
virtual_keyboard: true
input_method: true
virtual_pointer: true
[2026-04-27][09:44:52][enigo::platform][DEBUG] wayland connection established
[2026-04-27][09:44:52][enigo::platform][DEBUG] trying to establish a x11 connection to $DISPLAY
[2026-04-27][09:44:52][enigo::platform::x11][DEBUG] using x11rb
[2026-04-27][09:44:52][enigo::platform::x11][ERROR] DisplayParsingError(DisplayNotSet)
[2026-04-27][09:44:52][enigo::platform][WARN] failed to establish x11 connection: no connection could be established: (failed to establish the connection)
[2026-04-27][09:44:52][handy_app_lib::commands][INFO] Enigo initialized successfully after permission grant

Unclear why, but the wayland impl depends on x11kbcommon, which I also added to commonNativeDeps in the flake.

@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Apr 27, 2026

Interesting okay. I think we have not enabled Wayland as a feature as I believe it was marked experimental or had some chances of breaking things for other users, would need more widespread testing on it before release

@LukeCarrier
Copy link
Copy Markdown
Author

As far as I can tell Enigo doesn't use the wayland implementation at all unless WAYLAND_DISPLAY is set in its environment. I'm not familiar with the library, so happy to defer to you on testing. Is there anything you'd like from me?

An unrelated idea I had that may be useful was to have the PR workflow produce binaries, so once you've approved the workflow run we could direct users at those unstable builds without having them need to have a working Rust toolchain. The flake makes it easy for Nix users, but I'm aware we are the minority. I can have a go at doing this in a fork if you like.

@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Apr 27, 2026

There's already one for this :)

@LukeCarrier LukeCarrier changed the title fix(wayland): tolerate Enigo failing to initialise fix(wayland): initialise Enigo, and tolerate failure Apr 28, 2026
@blockedby
Copy link
Copy Markdown

Interesting okay. I think we have not enabled Wayland as a feature as I believe it was marked experimental or had some chances of breaking things for other users, would need more widespread testing on it before release

new ubuntu LTS comes without x11 at all, so please, take care of this env =)

@LukeCarrier
Copy link
Copy Markdown
Author

new ubuntu LTS comes without x11 at all, so please, take care of this env =)

I know you want to see this fixed, but please don't pile on the maintainer leaving comments which are neither actionable nor particularly constructive. You can 👍 the PR to show interest, you don't need to keep spamming the maintainer and I.

@karitham
Copy link
Copy Markdown

karitham commented Apr 30, 2026

I've been running this branch for the past few days and can confirm it works perfectly on wayland (niri, nixos). Handy did not work at all before this fix for me (enigo init failure, same as reported here).

I don't really have any non-wayland setups to run it from, but on this side it works perfectly!

@Algorant
Copy link
Copy Markdown

Algorant commented May 2, 2026

Oh nice I had this or a very similar issue on main release using arch linux and niri.

Codex 5.5 suggested using xwayland-satellite and adding a small fake display to my config, then Enigo finds that and the flow I actually use (that shouldn't require Enigo at all) is able to continue.

I'll test this branch and see if I can repro/it fixes my issue as well.

Update: @LukeCarrier's patch fixes my issue as well.

Summary from codex:

  The important part of the new log is:

  DisplayParsingError(DisplayNotSet)
  failed to establish x11 connection
  Enigo initialized successfully after permission grant
  ...
  Using paste method: Direct, delay: 60ms
  Using user-specified wtype
  Text pasted successfully in 110.795336ms

  That means:

  - DISPLAY was still unset
  - X11 init still failed, as expected
  - the patched Enigo path tolerated that instead of aborting
  - Handy continued on the Wayland path
  - it used wtype
  - paste succeeded

  Your test transcript was:

  Testing my audio stuff.

  So this confirms the LukeCarrier fix addresses the real issue we were seeing on niri Wayland. The upstream report back to Handy can be pretty strong now: with
  the patched build, pure Wayland works without needing the xwayland-satellite workaround to get past Enigo state not initialized.```

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.

5 participants