1
0
Fork 0
mirror of https://github.com/Luzifer/streamdeck.git synced 2024-12-20 09:41:19 +00:00

Add action to switch pages

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-11-21 01:15:07 +01:00
parent f2244140ae
commit 0c0602b773
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 19 additions and 1 deletions

View file

@ -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")
}

View file

@ -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