add multimedia keys

This commit is contained in:
Unrud 2018-09-30 00:26:31 +02:00
parent b3b068fe59
commit 34f4dbf77a
21 changed files with 1457 additions and 76 deletions

View file

@ -66,13 +66,20 @@ func processCommand(plugin Plugin, command string) error {
return plugin.KeyboardText(text)
}
arguments := strings.Split(command[1:], ";")
if len(arguments) != 2 {
if command[0] == 'k' && len(arguments) != 1 ||
command[0] != 'k' && len(arguments) != 2 {
return errors.New("wrong number of arguments")
}
x, err := strconv.ParseInt(arguments[0], 10, 32)
if err != nil {
return err
}
if command[0] == 'k' {
if x < 0 || x >= int64(KeyLimit) {
return errors.New("unsupported key")
}
return plugin.KeyboardKey(Key(x))
}
y, err := strconv.ParseInt(arguments[1], 10, 32)
if err != nil {
return err