Skip to content

Commit eae5470

Browse files
committed
Add installation steps
This includes creating and starting a systemd service for the daemon `ydotoold` and adding the YDOTOOL_SOCKET variable to .zshrc
1 parent 89e24d9 commit eae5470

File tree

1 file changed

+50
-26
lines changed

1 file changed

+50
-26
lines changed

README.md

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,8 @@ ydotool will then be rewritten in JavaScript afterwards, to enable more people t
1414
## Important Note
1515
The man page is not always up to date. Please use `--help` to ensure correctness.
1616

17-
## ChangeLog
18-
This project is now refactored. (from v1.0.0)
19-
20-
Changes:
21-
- Rewritten in pure C99
22-
- No external dependencies
23-
- Uses a lot less memory & no dynamic memory allocation
24-
25-
Breaking Changes:
26-
- `recorder` removed because it's irrelevant. It will become a separate project
27-
- Command chaining and `sleep` are removed because this should be your shell's job
28-
- `ydotool` now must work with `ydotoold`
29-
- Usage of `click` and `key` are changed
30-
31-
Good News:
32-
- Some people can finally build this project offline
33-
- `key` now (only) accepts keycodes, so it's not limited to a specific keyboard layout
34-
- Now it's possible to implement support for different keyboard layouts in `type`
35-
3617
## Usage
18+
### Commands
3719
Currently implemented command(s):
3820
- `click` - Click on mouse buttons
3921
- `mousemove` - Move mouse pointer to absolute position
@@ -43,7 +25,7 @@ Currently implemented command(s):
4325
- `bakers` - Show the honorable bakers
4426
- `stdin` - Sends the key presses as it was a keyboard (i.e from ssh) See [PR #229](https://github.com/ReimuNotMoe/ydotool/pull/229)
4527

46-
## Examples
28+
### Examples
4729
Switch to tty1 (Ctrl+Alt+F1), wait 2 seconds, and type some words:
4830

4931
ydotool key 29:1 56:1 59:1 59:0 56:0 29:0; sleep 2; ydotool type 'echo Hey guys. This is Austin.'
@@ -72,14 +54,18 @@ Repeat the keyboard presses from stdin:
7254

7355
ydotool stdin
7456

57+
Click keys ctrl+Tab (equivalent of `xdotool ctrl+Tab`):
58+
59+
ydotool key 29:1 15:1 29:0 15:0
60+
7561
## Notes
76-
#### Runtime
77-
`ydotoold` (daemon) program requires access to `/dev/uinput`. **This usually requires root permissions.**
62+
### Available key names
63+
To get all key names check out `/usr/include/linux/input-event-codes.h`.
7864

79-
#### Available key names
80-
See `/usr/include/linux/input-event-codes.h`
65+
### Runtime
66+
`ydotoold` (daemon) program requires access to `/dev/uinput`. **This usually requires root permissions.**
8167

82-
#### Why a background service is needed
68+
### Why a background service is needed
8369
ydotool works differently from xdotool. xdotool sends X events directly to X server, while ydotool uses the uinput framework of Linux kernel to emulate an input device.
8470

8571
When ydotool runs and creates a virtual input device, it will take some time for your graphical environment (X11/Wayland) to recognize and enable the virtual input device. (Usually done by udev)
@@ -101,7 +87,6 @@ There are a few extra options that can be configured when running CMake
10187
- SYSTEMD_SYSTEM_SERVICE=ON|OFF - whether to use systemd system service file, depends on ``systemd``. Default: OFF
10288
- OPENRC=ON|OFF - whether to use openrc service file. Default: OFF (TBD)
10389

104-
10590
### Compile
10691

10792
mkdir build
@@ -118,6 +103,45 @@ Debian-based:
118103
RHEL-based:
119104

120105
sudo dnf install scdoc
106+
107+
## Installation
108+
### Create a systemd service
109+
In order for `ydotool` to work the `ydotoold` deaemon must be running.
110+
1. Create a new service file:
111+
`sudo nano /etc/systemd/system/ydotool.service`
112+
and paste this:
113+
```
114+
[Unit]
115+
Description=ydotool daemon
116+
Documentation=https://github.com/ReimuNotMoe/ydotool
117+
118+
[Service]
119+
Type=simple
120+
ExecStart=/usr/local/bin/ydotoold --socket-path=/run/user/1000/.ydotool_socket --socket-perm 0666
121+
Restart=always
122+
123+
[Install]
124+
WantedBy=multi-user.target
125+
```
126+
2. Start the service:
127+
```
128+
sudo systemctl daemon-reload
129+
sudo systemctl enable ydotool
130+
sudo systemctl start ydotool
131+
```
132+
3. Check that the service is running correctly:
133+
```
134+
sudo systemctl status ydotool
135+
```
136+
4. Add this to your `~/.zshrc` (or `~/.bashrc` or else):
137+
```bash
138+
export YDOTOOL_SOCKET="/run/user/1000/.ydotool_socket"
139+
```
140+
5. Test that everything is working as expected:
141+
```
142+
ydotool type hello
143+
```
144+
121145
## Troubleshooting
122146
### Custom keyboard layouts
123147
Currently, ydotool does not recognize if the user is using a custom keyboard layout. In order to comfortably use ydotool alongside a custom keyboard layout, the user could use one of the following fixes/workarounds:

0 commit comments

Comments
 (0)