add --keyboard-name option

This commit is contained in:
John Gebbie 2023-08-15 12:53:04 +01:00
parent ee4a1cd95d
commit d1e4b66dd1
2 changed files with 18 additions and 7 deletions

View file

@ -244,6 +244,7 @@ func main() {
initKeys(keymap)
}
keyboardName := []byte("dotool keyboard")
{
optset := opt.NewOptionSet()
@ -254,6 +255,11 @@ func main() {
})
optset.Alias("h", "help")
optset.Func("keyboard-name", func(s string) error {
keyboardName = []byte(s)
return nil
})
optset.FlagFunc("list-keys", func() error {
listKeys(keymap, LinuxKeys)
os.Exit(0)
@ -281,7 +287,7 @@ func main() {
}
}
keyboard, err := uinput.CreateKeyboard("/dev/uinput", []byte("dotool keyboard"))
keyboard, err := uinput.CreateKeyboard("/dev/uinput", keyboardName)
if err != nil {
fatal(err.Error())
}

15
dotoold
View file

@ -1,10 +1,15 @@
#!/bin/sh
if [ $# != 0 ]; then
for a; do
case "$a" in
-h|--help)
echo 'dotoold runs dotool reading from a pipe for dotoolc to write to. dotoold
will exit immediately if the pipe is already being read. The path used
for the pipe is $DOTOOL_PIPE else /tmp/dotool-pipe.' >&2
[ "$1" = -h ] || [ "$1" = --help ]; exit
fi
exit
;;
--) break;;
esac
done
fifo_being_read(){
[ -p "$1" ] && /bin/echo 1<>"$1" >"$1"
@ -20,5 +25,5 @@ fi
rm -f -- "$p" || exit 1
trap 'rm -f -- "$p"; pkill -P $$; trap - EXIT; exit' EXIT INT TERM HUP
mkfifo -m 660 "$p" || exit 1
dotool <> "$p" &
wait
dotool "$@" <> "$p" &
wait $!