Skip to content

Instantly share code, notes, and snippets.

@komamitsu
Last active November 2, 2024 11:22
Show Gist options
  • Save komamitsu/307669cfedb9d97cef45c86f357b9b5b to your computer and use it in GitHub Desktop.
Save komamitsu/307669cfedb9d97cef45c86f357b9b5b to your computer and use it in GitHub Desktop.
Execute xremap from systemd

Execute xremap as root user

Create /etc/systemd/system/xremap.service file

[Unit]
Description=xremap service
After=default.target

[Service]
ExecStart=/usr/bin/xremap /home/komamitsu/xremap.yml

[Install]
WantedBy=default.target

Register the service to systemd

sudo systemctl enable xremap.service

Start the service

sudo systemctl start xremap.service

Execute xremap as a normal user

(Thank you https://github.com/dcraig327!)

Allow the user to access input events

Add the user to input group if it's not added.

sudo gpasswd -a YOUR_USER input

Then, execute the following command if /etc/udev/rules.d/input.rules doesn't have the entry.

echo 'KERNEL=="uinput", GROUP="input", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/input.rules

Create $HOME/.config/systemd/user/xremap.service file

[Unit]
Description=xremap
After=default.target

[Service]
ExecStart=%h/.cargo/bin/xremap %h/.config/xremap/config.yml
StandardOutput=journal
StandardError=journal
Restart=always

[Install]
WantedBy=default.target

Register the service to systemd

systemctl --user enable xremap.service

Start the service

systemctl --user start xremap.service
@komamitsu
Copy link
Author

@dcraig327 Thanks! I'll try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment