Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland backend #331

Open
tbm opened this issue Dec 17, 2020 · 12 comments
Open

Wayland backend #331

tbm opened this issue Dec 17, 2020 · 12 comments

Comments

@tbm
Copy link
Contributor

tbm commented Dec 17, 2020

@TMiguelT made a good summary in #184 (comment) about what it would take to create a wayland backend.

Is anyone working on this?

@multimeric
Copy link

Yes, the uinput backend is implemented: https://github.com/moses-palmer/pynput/blob/master/CHANGES.rst#v170-2020-08-30---a-new-backend-and-many-new-features-and-bug-fixes.

I believe it should automatically activate when you're on Linux, aren't on X11 and possibly you will have to run the script with sudo. Otherwise, I think the backend is called uinput if you want to force it to enable.

@tbm
Copy link
Contributor Author

tbm commented Dec 17, 2020

I know about uinput, but I was referring to your comments about becoming a Wayland client.

@multimeric
Copy link

multimeric commented Dec 17, 2020

Oh right, no. As I explain in the comment you linked to, that approach wouldn't consistently work. Rather we will have to wait for a virtual device proposal to get passed and implemented in Wayland. I'm not sure where any of that stuff is up to, however.

@tbm
Copy link
Contributor Author

tbm commented Dec 17, 2020

Oh right, I thought there might have been progress (on the Wayland side) since your comment was from a year ago.

@multimeric
Copy link

Oh it seems there has been some progress. So on the Wayland protocol side there are a few proposals but neither have been accepted:

What's interesting, though, is that both of these protocols are apparently already implemented in sway and other wlroots-based compositors. I think this code snippet demonstrates a CLI for manipulating the pointer (like xdotool) for compositors that support the protocol: https://github.com/swaywm/wlroots/blob/master/examples/virtual-pointer.c. I suppose there is some argument against building on a protocol that isn't yet officially part of Wayland, but still it looks like the best option at the moment.

@tbm
Copy link
Contributor Author

tbm commented Dec 18, 2020

That sounds interesting.

Unfortunately, I'm not advanced enough to contribute support. If you add this or mouse support for uinput (#332), I'd be happy to test though.

@moses-palmer
Copy link
Owner

The long term solution for Wayland support would be to implement these protocols, but I am reluctant to do that before they have been finalised and thoroughly documented.

@multimeric
Copy link

Agreed. But in theory if someone urgently wanted this feature now, I think they could implement C bindings for these unstable protocols, and you could get Python automating the mouse + keyboard on certain Wayland environments (not stock Gnome, though, which I assume is the most common DE on Linux atm).

@TheLastGimbus
Copy link

Hi there! Now that Ubuntu 21 is out, and using Wayland by default, the library seems to be bugging a bit 😕

But it does work... sometimes?

@moses-palmer
Copy link
Owner

Yes, it still works with applications running under XWayland, but Wayland being default on Ubuntu makes an implementation for the protocols listed above even more urgent.

@orowith2os
Copy link

orowith2os commented Jan 8, 2023

A global keybinds portal exists now, as of xdg-desktop-portal 1.16.

As for emulating input, it'll either need root or an external library such as libei (which is currently being worked on to go through xdg-desktop-portal as well).

You could also possibly manage this via the RemoteDesktop portal.

@7RST1
Copy link

7RST1 commented Oct 10, 2023

As for emulating input, it'll either need root or an external library such as libei (which is currently being worked on to go through xdg-desktop-portal as well).

Looks like libei 1.0 was released in June, with 1.1.0 already being out by now. Here is the release announcement:
https://lists.freedesktop.org/archives/wayland-devel/2023-June/042731.html

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

No branches or pull requests

6 participants