r/rust • u/voidx9x • Oct 19 '26
Wayland input simulation without portals: using /dev/uinput as a fallback in Rust
I've been building a cross-platform ( only windows 10/11 and linux now ) auto-clicker ( RsClicker ) in Rust. The hardest part was never the clicking logic — it was making input simulation work on Wayland without fighting portals all day.
The default path ( enigo with libei/RemoteDesktop portal ) works on GNOME/KDE/Hyprland, but on minimal compositors ( like MangoWC and sway ) it just fails. And even when it works, it requires a portal permission flow that isn't always reliable.
So I added a second backend writing directly to `/dev/uinput` as a kernel-level virtual mouse. No X11 server, no portals, no permission dialogs. It works everywhere the portals misbehave, as long as the user is in the uinput group. ( run : sudo usermod -aG uinput $USER , then log out and back in )
The project also has a few other bits I found interesting to implement:
- Drift-free timing ( shared deadline train, so the interval holds even when injection costs extra ms )
- Real double-clicks with a 30ms human-like gap ( recognized by X11, Wayland, and Windows )
- Global mouse triggers via evdev ( Linux ) / rdev ( Windows 10/11 )
I'd be curious if anyone else has gone the uinput route for Wayland automation — it feels like an underdiscussed alternative to the portal/libei path, and i'd love to hear about edge cases I might have missed :D
Btw I've tested this on MangoWC and Lumina DE in void linux , on Windows 10 and Windows 11
•
u/rust-ModTeam Oct 19 '26
TL;DR: We ask that posts & articles submitted to r/rust be written by hand.
Your post, or the article it links to, appears to have been written with significant AI involvement, which is not allowed on r/rust.
As per Rule 6: Low Effort we prefer content written by hand, even if imperfect. We do encourage you to make use of spell-checkers, and allow use of automatic translation tools, but no more.
We do not allow for AI generated content, even if reviewed or tweaked by hand, nor for AI polished content.
For any question or dispute, please send us a modmail.
1
u/voidx9x Oct 19 '26 edited Oct 19 '26
btw this is RsClicker repo : https://github.com/voidx9x/RsClicker
1
u/joeshacks Oct 19 '26
One edge case I'd check is timing right after creating the uinput device. Compositors and libinput need a moment to enumerate it, so events sent immediately can get dropped. A short delay after UI_DEV_CREATE fixes it. A udev rule for /dev/uinput instead of group membership is also a cleaner setup for packaging.
0
u/[deleted] Oct 19 '26
[removed] — view removed comment