diff --git a/cmd/streamdeck/action_page.go b/cmd/streamdeck/action_page.go new file mode 100644 index 0000000..0c9ecfc --- /dev/null +++ b/cmd/streamdeck/action_page.go @@ -0,0 +1,18 @@ +package main + +import "github.com/pkg/errors" + +func init() { + registerAction("page", actionPage{}) +} + +type actionPage struct{} + +func (actionPage) Execute(attributes map[string]interface{}) error { + name, ok := attributes["name"].(string) + if !ok { + return errors.New("No page name supplied") + } + + return errors.Wrap(togglePage(name), "Unable to switch page") +} diff --git a/cmd/streamdeck/main.go b/cmd/streamdeck/main.go index c13ff52..66ae88c 100644 --- a/cmd/streamdeck/main.go +++ b/cmd/streamdeck/main.go @@ -126,7 +126,7 @@ func togglePage(page string) error { func triggerAction(kd keyDefinition) error { if kd.Action.Type != "" { - return errors.Wrap(callAction(kd), "Unable to execute action") + return callAction(kd) } return nil