From 7aadedf03cd10f74f74e294e08bc2b3bc233c6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= Date: Wed, 5 May 2021 15:59:18 +0200 Subject: [PATCH] Add Meta/Windows/Super_L modifier (#10) --- cmd/streamdeck/action_keyPress.go | 13 ++++++++++--- cmd/streamdeck/config.go | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/streamdeck/action_keyPress.go b/cmd/streamdeck/action_keyPress.go index ee4ae4f..f69c29d 100644 --- a/cmd/streamdeck/action_keyPress.go +++ b/cmd/streamdeck/action_keyPress.go @@ -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") diff --git a/cmd/streamdeck/config.go b/cmd/streamdeck/config.go index 7da66e9..6b9414f 100644 --- a/cmd/streamdeck/config.go +++ b/cmd/streamdeck/config.go @@ -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"`