1
0
Fork 0
mirror of https://github.com/Luzifer/streamdeck.git synced 2024-10-18 05:04:18 +00:00

Add Meta/Windows/Super_L modifier (#10)

This commit is contained in:
Oliver Rümpelein 2021-05-05 15:59:18 +02:00 committed by GitHub
parent a8ce516a64
commit 7aadedf03c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -47,25 +47,32 @@ func (actionKeyPress) Execute(attributes attributeCollection) error {
if attributes.ModShift {
if err := kbd.KeyDown(uinput.KeyLeftShift); err != nil {
return errors.Wrap(err, "Unable to set shift")
return errors.Wrap(err, "Unable to set Shift key")
}
defer kbd.KeyUp(uinput.KeyLeftShift)
}
if attributes.ModAlt {
if err := kbd.KeyDown(uinput.KeyLeftAlt); err != nil {
return errors.Wrap(err, "Unable to set shift")
return errors.Wrap(err, "Unable to set Alt key")
}
defer kbd.KeyUp(uinput.KeyLeftAlt)
}
if attributes.ModCtrl {
if err := kbd.KeyDown(uinput.KeyLeftCtrl); err != nil {
return errors.Wrap(err, "Unable to set shift")
return errors.Wrap(err, "Unable to set Ctrl key")
}
defer kbd.KeyUp(uinput.KeyLeftCtrl)
}
if attributes.ModMeta {
if err := kbd.KeyDown(uinput.KeyLeftMeta); err != nil {
return errors.Wrap(err, "Unable to set Meta key")
}
defer kbd.KeyUp(uinput.KeyLeftMeta)
}
for _, kc := range execCodes {
if err := kbd.KeyPress(kc); err != nil {
return errors.Wrap(err, "Unable to press key")

View file

@ -37,6 +37,7 @@ type attributeCollection struct {
ModAlt bool `json:"mod_alt,omitempty" yaml:"mod_alt,omitempty"`
ModCtrl bool `json:"mod_ctrl,omitempty" yaml:"mod_ctrl,omitempty"`
ModShift bool `json:"mod_shift,omitempty" yaml:"mod_shift,omitempty"`
ModMeta bool `json:"mod_meta,omitempty" yaml:"mod_meta,omitempty"`
Mute string `json:"mute,omitempty" yaml:"mute,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`