dotool/README.md

71 lines
1.8 KiB
Markdown
Raw Normal View History

2022-10-20 15:21:20 +02:00
# dotool
2023-04-19 14:23:05 +02:00
dotool reads commands from stdin and simulates keyboard and pointer events.
2022-10-20 15:21:20 +02:00
It works everywhere on Linux, including in X11, Wayland and TTYs.
2022-10-24 11:29:35 +02:00
## Install From Source
2022-10-20 15:21:20 +02:00
2023-04-19 14:23:05 +02:00
With `go` and `libxkbcommon-dev` installed, run:
2023-01-07 00:03:48 +01:00
sudo ./install.sh
2022-10-20 15:21:20 +02:00
2023-03-05 16:08:52 +01:00
## Permission
2022-10-20 15:21:20 +02:00
2023-03-05 16:08:52 +01:00
dotool requires permission to `/dev/uinput` to create the virtual input
devices, and a udev rule grants this to users in group input.
2023-01-07 00:03:48 +01:00
2023-03-05 16:08:52 +01:00
You could try:
2022-10-20 15:21:20 +02:00
2023-03-05 16:08:52 +01:00
echo type hello | dotool
2023-01-07 00:03:48 +01:00
2023-03-05 16:08:52 +01:00
and if need be, you can run:
2022-10-20 15:21:20 +02:00
2023-03-05 16:08:52 +01:00
sudo groupadd -f input
sudo usermod -a -G input $USER
2023-01-07 00:03:48 +01:00
2023-03-05 16:08:52 +01:00
and re-login and trigger the udev rule or just reboot.
## Usage
See `dotool --help`, but this greets the world:
2022-10-20 15:21:20 +02:00
2023-03-05 16:08:52 +01:00
echo 'type Sup, Lads!' | dotool
2023-01-07 00:03:48 +01:00
2023-03-05 16:08:52 +01:00
and this screams for three seconds:
{ echo keydown A; sleep 3; echo key H shift+1; } | dotool
2022-10-20 15:21:20 +02:00
2023-04-19 14:23:05 +02:00
There is an initial delay registering the virtual devices, but you can
keep writing commands to the same instance or use the daemon and client,
`dotoold` and `dotoolc`.
2023-01-07 00:03:48 +01:00
dotoold &
2023-04-19 14:23:05 +02:00
echo type super | dotoolc
echo type speedy | dotoolc
## Keyboard Layouts
2023-05-11 12:16:22 +02:00
dotool will type gobbledygook if your environment has assigned it a different
keyboard layout than it's simulating keycodes for. You can match them up
with the environment variables `DOTOOL_XKB_LAYOUT` and `DOTOOL_XKB_VARIANT`.
2023-04-19 14:23:05 +02:00
echo type azerty | DOTOOL_XKB_LAYOUT=fr dotool
2022-10-20 15:21:20 +02:00
## Numen and Contact
2022-10-20 15:21:20 +02:00
dotool was written for [Numen](https://numenvoice.org), which has a
[chat on Matrix](https://matrix.to/#/#numen:matrix.org) you're welcome to join.
2023-01-06 23:58:41 +01:00
You can also send questions, thoughts or patches by composing an email to
[~geb/public-inbox@lists.sr.ht](https://lists.sr.ht/~geb/public-inbox).
## Support Me
[Thank you!](https://liberapay.com/geb)
2022-11-19 11:08:08 +01:00
## License
GPLv3 only, see [LICENSE](./LICENSE).
2023-01-09 14:28:39 +01:00
Copyright (c) 2022-2023 John Gebbie