diff --git a/80-dotool.rules b/80-dotool.rules new file mode 100644 index 0000000..6f3d49e --- /dev/null +++ b/80-dotool.rules @@ -0,0 +1,2 @@ +# This allows users in group input to use dotool without root permissions. +KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput" diff --git a/README.md b/README.md index 11dccb2..630b207 100644 --- a/README.md +++ b/README.md @@ -5,18 +5,13 @@ It works everywhere on Linux, including in X11, Wayland and TTYs. It takes about half a second to register the virtual device, but it can be kept using the daemon. -## Install +## Install From Source -Run `go build` with go (>=1.19) and copy `dotool`, `dotoold` and `dotoolc` into your PATH. +With go (>=1.19) run `sudo ./install.sh`. ## Usage -dotool will usually require root permissions unless you add a udev rule for uinput. -You could run these commands to add a rule for yourself and make it effective: -``` -echo KERNEL==\"uinput\", GROUP=\"$USER\", MODE:=\"0660\" | sudo tee /etc/udev/rules.d/99-dotool-$USER.rules -sudo udevadm trigger -``` +dotool will require root permissions unless you are in group input. This greets the world: `echo 'type Sup, Lads!' | dotool` diff --git a/dotool.go b/dotool.go index 83c844a..ffc3382 100644 --- a/dotool.go +++ b/dotool.go @@ -168,6 +168,10 @@ The commands are: Example: echo "key h i shift+1" | dotool +dotool is installed with a udev rule to allow users in group input to run +it without root permissions. You can make it effective without rebooting by +running: sudo udevadm trigger + The keys are those used by Linux, but can also be specified using X11 names prefixed with x: like x:exclam, as well as their Linux keycode like k:30. They are case insensitive, except uppercase character keys also simulate shift. diff --git a/install.sh b/install.sh index 8b8bc86..0c6fdd2 100755 --- a/install.sh +++ b/install.sh @@ -1,2 +1,4 @@ #!/bin/sh -go build && cp dotool dotoolc dotoold /usr/local/bin +go build && cp -v dotool dotoolc dotoold /usr/local/bin +cp -v 80-dotool.rules /etc/udev/rules.d +udevadm trigger diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..b723ee2 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,3 @@ +#!/bin/sh +rm -vf /usr/local/bin/dotool /usr/local/bin/dotoolc /usr/local/bin/dotoold +rm -vf /etc/udev/rules.d/80-dotool.rules