这是indexloc提供的服务,不要输入任何密码
Skip to content

linux: libei issues #453

@nekename

Description

@nekename

Image

Issue 1

The first issue is that if enigo::execute is called from within a Tokio runtime (even in a sync function called by an async one), it panics, because of the attempt to start a runtime from within a runtime (

let runtime = tokio::runtime::Runtime::new()
). This is easily solved with std::thread::spawn but thought you should know.

Issue 2 (SOLVED)

The solution is to persist the Enigo struct instead of creating a new one for each invocation.

The second issue is that it only appears to work once, then I need to restart the program. The first time I try it, I get a popup asking for permission, then this happens (amidst other logs for Wayland and X11 attempts):

17:04:37 [DEBUG] (19) enigo::platform::libei: using libei
17:04:37 [DEBUG] (19) enigo::platform::libei: Unable to find ei socket. Trying xdg desktop portal.
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform::libei: ping
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform::libei: device resumed
17:04:39 [DEBUG] (19) enigo::platform::libei: device resumed
17:04:39 [DEBUG] (19) enigo::platform::libei: device resumed
17:04:39 [DEBUG] (19) enigo::platform::libei: update
Start emulating
Start emulating
Start emulating
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform: libei connection established
17:04:39 [DEBUG] (19) enigo::platform: �[93mkey(key: F11, direction: Click)�[0m
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform::libei: update
17:04:39 [DEBUG] (19) enigo::platform: entered the key via libei

Any subsequent attempts get this:

17:04:40 [DEBUG] (37) enigo::platform::libei: using libei
17:04:40 [DEBUG] (37) enigo::platform::libei: Unable to find ei socket. Trying xdg desktop portal.

Issue 3

With the libei feature enabled, X11 input simulation no longer works. It seems to work fine without libei enabled. I can't speak for Wayland, as I haven't ever been able to make the Wayland feature work (here are the Wayland logs):

17:30:07 [DEBUG] (19) enigo::platform::wayland: protocols available
virtual_keyboard: false
input_method: false
virtual_pointer: false
17:30:07 [WARN] no connection could be established: (no protocol available to simulate input)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions