☰ Dup Goto 📝

YdotoolSetupDebian

PT2/linux/setup-notes 10-15 13:37:49
To Pop
131 lines, 384 words, 2793 chars Thursday 2026-10-15 13:37:49

To install:

sudo apt install ydotool

This is from Gemini.

To ensure ydotoold automatically starts and is available system-wide without requiring sudo or manual intervention, the cleanest approach on modern Linux (Wayland/X11) is to set up ydotoold as a systemd user service and give your user access to the /dev/uinput device via a udev rule.

Here is the complete step-by-step procedure:


Step 1: Grant Your User Access to /dev/uinput

By default, /dev/uinput requires root permissions. Setting up a udev rule lets your user interact with the virtual input subsystem safely without sudo.

1. Create the input group (if it doesn't already exist):

sudo groupadd -f input

2. Add your user to the input group:

sudo usermod -aG input $USER

3. Create a udev rule for uinput:

Create /etc/udev/rules.d/80-uinput.rules:

echo 'KERNEL=="uinput", GROUP="input", MODE="0660"' | sudo tee /etc/udev/rules.d/80-uinput.rules

4. Reload udev rules:

sudo udevadm control --reload-rules && sudo udevadm trigger

(Note: You will need to log out and log back in or run newgrp input for the group changes to take effect).


Step 2: Create a Systemd User Service

1. Create the user systemd directory:

mkdir -p ~/.config/systemd/user/

2. Create the service unit file:

Save the following as ~/.config/systemd/user/ydotoold.service:

[Unit]
Description=ydotool daemon
Documentation=man:ydotoold(8)

[Service]
Type=simple
ExecStart=/usr/bin/ydotoold
Restart=on-failure
RestartSec=2s

[Install]
WantedBy=default.target

(If your ydotoold binary is in /usr/local/bin/ydotoold, update the ExecStart path accordingly by checking with which ydotoold).


Step 3: Enable and Start the Service

1. Reload systemd user daemon:

systemctl --user daemon-reload

2. Enable and start ydotoold immediately:

systemctl --user enable --now ydotoold

3. Verify the service status:

systemctl --user status ydotoold

You should see active (running).


Step 4: Add Socket Environment Variable (Optional / Troubleshooting)

If ydotool complains about not finding /tmp/ydotool_socket or permission errors, add the default socket path to your environment:

Add this to your ~/.bashrc, ~/.zshrc, or shell configuration profile:

export YDOTOOL_SOCKET="/tmp/ydotool_socket"

Verification

Test that ydotool works without sudo or any background terminal:

ydotool key 57:1 57:0   # Sends Spacebar press/release

Now ydotoold will automatically launch in the background as your user whenever you boot into your desktop session.