| nix | ||
| src | ||
| .envrc | ||
| .gitignore | ||
| .ignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
whydotool
A Wayland-native command-line automation tool.
Inspired by ydotool, it simulates keyboard and mouse input using native Wayland protocols.
Features
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
Requirements
whydotool works on most major Wayland compositors via either:
-
Native Wayland protocols
-
xdg-desktop-portalRemoteDesktop interface
Protocol Support
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.
Build
Clone the repository and enter it:
git clone https://forgejo.r0chd.pl/r0chd/whydotool
cd whydotool
To build with the default configuration:
cargo build --release
To explicitly disable portal support:
cargo build --no-default-features --release
Disabling portal support reduces dependencies and binary size, but limits compatibility to compositors that implement the native virtual input protocols.
After building binary can be found at ./target/release/whydotool
Examples
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
whydotool vs. ydotool
| 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 |