Wayland client and synthetic input
Jonas Ådahl
jadahl at redhat.com
Fri May 16 10:12:52 UTC 2025
On Wed, May 14, 2025 at 11:27:50PM +0000, Zarif Atai wrote:
> Dear subscribers of wayland-devel,
>
> As a Vim motions enthusiast, it bothers me that there are too many situations where I'm forced to use a pointer input device (e.g. a mouse) to perform an action. I looked around to see if anyone has developed a tool that would allow me to move or teleport the pointer to a specific location on the screen and perform a click action using keyboard keystrokes. I did not find it, so I decided to create it myself. I have recently started to learn the programming language Rust. I thought this would be a great opportunity to improve my Rust skills, too.
>
> As someone new to both Wayland and Rust, I dove into the Wayland documentation and related Rust crates. Thus far, I have not found any documentation on how to send synthetic input (i.e. mouse movements) to the display server as a Wayland client. According to some LLMs, synthetic input is even heavily restricted in Wayland due to security reasons, making my quest to create this tool impossible.
>
> I would like to ask for your input (no pun intended) on this. Is it true what the LLMs are saying? If so, are there alternative ways to develop such a tool?
While not strictly Wayland, you can inject synthetic input via libei
using the remote desktop portal. It does so with sandboxing/security in
mind, by being a portal. See
https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.RemoteDesktop.html
for details. Whether it works on your compositor depends on the portal
backend used.
Some compositors may support the virtual keyboard or virtual pointer
protocols as well. See
https://wayland.app/protocols/wlr-virtual-pointer-unstable-v1 and
https://wayland.app/protocols/virtual-keyboard-unstable-v1.
Jonas
>
> I'm looking forward to your responses.
>
> Sincerely,
> Zarif Atai
More information about the wayland-devel
mailing list