A Wayland-native command-line automation tool.
Inspired by ydotool, it simulates keyboard and mouse input using native Wayland protocols, no root privileges, no daemons, no kernel hacks.
click
- simulate mouse button pressesmousemove
- Move the pointer (relative or absolute)type
- type strings of textkey
- press and release individual keysstdin
- stream key events from standard input in real time- no root required
- no daemon required
whydotool
works on most major Wayland compositors via either:
-
Native Wayland protocols
-
xdg-desktop-portal
RemoteDesktop interface
Keyboard input (key
, type
, stdin
):
Pointer input (click
, mousemove
):
Universal alternative: If your compositor doesn’t support the above protocols, whydotool can use the xdg-desktop-portal RemoteDesktop interface. See the list of supported backends
If your compositor doesn't support the specific protocols above, it will likely work through the portal interface. Check the linked compatibility tables to verify support for your compositor.
The portals
backend enables input injection via the xdg-desktop-portal
RemoteDesktop interface.
This is useful if your compositor doesn’t support the native virtual input protocols, like GNOME, which supports neither, or KDE Plasma, which lacks the virtual-keyboard protocol.
Build with:
cargo build --features portals
enabling portal drags in a bunch of heavy dependencies such as zbus and PipeWire, which significantly increases the final binary size and compilation times.
Type text:
whydotool type "Hello Wayland"
Press a key:
whydotool key 56:1 62:1 62:0 56:0
Relatively move mouse pointer by -100,100:
whydotool mousemove -x -100 -y 100
Move mouse pointer to 100,100:
whydotool mousemove --absolute -x 100 -y 100
Mouse right click:
whydotool click 0xC1
Mouse repeating left click:
whydotool click --repeat 5 --next-delay 25 0xC0
Feature | whydotool | ydotool |
---|---|---|
Compatibility | Wayland only | Runs everywhere |
Security Model | Uses compositor-granted Wayland protocols or xdg-desktop-portal | Writes directly to uinput |
Privileges | Does not require root | Requires root privileges |
Daemon | Daemonless | Requires a running daemon |