replace --keyboard-name with $DOTOOL_KEYBOARD_NAME

This commit is contained in:
John Gebbie 2023-10-26 13:09:01 +01:00
parent ba251d1afd
commit 5404859248
2 changed files with 11 additions and 13 deletions

View file

@ -39,6 +39,10 @@ and *DOTOOL_XKB_VARIANT*. For example:
*echo type azerty | DOTOOL_XKB_LAYOUT=fr dotool* *echo type azerty | DOTOOL_XKB_LAYOUT=fr dotool*
You can also specify the name to give the virtual keyboard with the environment
variable *DOTOOL_KEYBOARD_NAME*, which can be useful making rules for your
environment.
Currently the *type* action has only heuristic support for dead keys. Currently the *type* action has only heuristic support for dead keys.
# OPTIONS # OPTIONS
@ -46,9 +50,6 @@ Currently the *type* action has only heuristic support for dead keys.
*-h*, *--help* *-h*, *--help*
Print help and exit. Print help and exit.
*--keyboard-name=*_NAME_
Specify the name to give the virtual keyboard device.
*--list-keys* *--list-keys*
Print the possible Linux keys and exit. Print the possible Linux keys and exit.

View file

@ -37,7 +37,6 @@ The supported actions are:
typedelay MILLISECONDS typedelay MILLISECONDS
typehold MILLISECONDS typehold MILLISECONDS
--keyboard-name=NAME Specify the name to give the keyboard device.
--list-keys Print the possible Linux keys and exit. --list-keys Print the possible Linux keys and exit.
--list-x-keys Print the possible XKB keys and exit. --list-x-keys Print the possible XKB keys and exit.
--version Print the version and exit. --version Print the version and exit.
@ -230,7 +229,6 @@ func main() {
initKeys(keymap) initKeys(keymap)
} }
keyboardName := []byte("dotool keyboard")
{ {
o := opt.NewOptSet() o := opt.NewOptSet()
@ -241,11 +239,6 @@ func main() {
}) })
o.Alias("h", "help") o.Alias("h", "help")
o.Func("keyboard-name", func(s string) error {
keyboardName = []byte(s)
return nil
})
o.FlagFunc("list-keys", func() error { o.FlagFunc("list-keys", func() error {
listKeys(keymap, LinuxKeys) listKeys(keymap, LinuxKeys)
os.Exit(0) os.Exit(0)
@ -273,6 +266,10 @@ func main() {
} }
} }
keyboardName := []byte(os.Getenv("DOTOOL_KEYBOARD_NAME"))
if len(keyboardName) == 0 {
keyboardName = []byte("dotool keyboard")
}
keyboard, err := uinput.CreateKeyboard("/dev/uinput", keyboardName) keyboard, err := uinput.CreateKeyboard("/dev/uinput", keyboardName)
if err != nil { if err != nil {
fatal(err.Error()) fatal(err.Error())