Welcome to a scuffed StreamDeck SDK written for Go.
- Potential to work
- Incomplete documentation
- Doubtful WebSocket handling
go get github.com/emilyxfox/go-streamdeck-sdk/streamdeck
Create a new struct that embeds streamdeck.BaseAction
and implements the event handler methods you need.
package main
import (
"log"
"strconv"
"github.com/emilyxfox/streamdeck-sdk/streamdeck"
)
type MyCounterAction struct {
streamdeck.ActionConfig
}
var counter uint32
func (a *MyCounterAction) HandleKeyDown(event *streamdeck.KeyDownEvent) {
log.Printf("Handling KeyDownEvent for UUID: %s, Event: %+v", a.UUID, event)
counter++
event.SetTitle(strconv.FormatUint(uint64(counter), 10))
}
func (a *MyCounterAction) HandleWillAppear(event *streamdeck.WillAppearEvent) {
event.SetTitle(strconv.FormatUint(uint64(counter), 10))
}
In your main
function, register the action, connect to the WebSocket, and start listening for events.
package main
import (
"log"
"github.com/emilyxfox/streamdeck-sdk/streamdeck"
)
func main() {
// Create and register your custom action
action := &MyCounterAction{
ActionConfig: streamdeck.ActionConfig{UUID: "com.emilyxfox.counter.counter"},
}
streamdeck.RegisterAction(action)
// Start listening for events
streamdeck.StartPlugin()
}
For more information and instructions on how to structure your plugin please refer to the official Stream Deck docs.