streamdeck

package module
v2.0.0-...-9029825 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 22 Imported by: 1 module, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

StreamDeck Go SDK

Elgato Stream Deck プラグインを Go で書くための SDK です。Stream Deck 7.1 時点の WebSocket プラグイン API に合わせています。

必要環境: Go 1.27 以降。メソッド固有の型パラメータを使うためです。

特徴

  • アクションごとに設定型を束ねる Action[S]
  • Property Inspector やグローバル設定はジェネリックメソッドで型付け
  • id による GetSettings / GetGlobalSettings / GetResources の応答待ち
  • Stream Deck + の dial / touch / setFeedback
  • didReceiveResources / didReceiveSecrets を含む SDK 7.1 の受信イベント

仕様の参照: Plugin WebSocket API(突き合わせ日: 2026-09-12)。

使い方

package main

import (
	"context"
	"os"
	"strconv"

	"github.com/FlowingSPDG/streamdeck/v2"
)

type Settings struct {
	Counter int `json:"counter"`
}

func main() {
	ctx := context.Background()

	params, err := streamdeck.ParseRegistrationParams(os.Args)
	if err != nil {
		panic(err)
	}

	client := streamdeck.NewClient(ctx, params)
	action := streamdeck.NewAction[Settings](client, "com.example.counter")

	action.OnKeyDown(func(ctx context.Context, e streamdeck.KeyDownEvent[Settings]) error {
		e.Payload.Settings.Counter++
		if err := action.SetSettings(ctx, e.Payload.Settings); err != nil {
			return err
		}
		return action.SetTitle(ctx, strconv.Itoa(e.Payload.Settings.Counter), streamdeck.HardwareAndSoftware)
	})

	if err := client.Run(ctx); err != nil {
		panic(err)
	}
}

Property Inspector のメッセージ型は設定型と別に渡せます。

type PIMessage struct {
	Action string `json:"action"`
}

action.OnPropertyInspectorMessage(func(ctx context.Context, m PIMessage) error {
	return action.SendToPropertyInspector(ctx, map[string]string{"action": "ok"})
})

例

examples/ を見てください。

  • counter — キー押下でカウント
  • cpu — CPU 使用率のグラフ
  • settings_manager — 複数インスタンスの設定管理
  • plus — Stream Deck + のダイヤルと setFeedback
cd examples
make build

移行

v1 からの破壊的変更は MIGRATION.md にまとめています。

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingPortFlag          = errors.New("missing -port flag")
	ErrMissingPluginUUIDFlag    = errors.New("missing -pluginUUID flag")
	ErrMissingRegisterEventFlag = errors.New("missing -registerEvent flag")
	ErrMissingInfoFlag          = errors.New("missing -info flag")
	ErrConnectionFailed         = errors.New("connection failed")
	ErrWriteFailed              = errors.New("write failed")
	ErrReadFailed               = errors.New("read failed")
	ErrInvalidMessage           = errors.New("invalid message")
	ErrNotConnected             = errors.New("client is not connected")
)

Stream Deck plugin errors.

Functions

func Image

func Image(i image.Image) (string, error)

Image encodes img as a PNG data URL suitable for SetImage.

Types

type Action

type Action[S any] struct {
	// contains filtered or unexported fields
}

Action is a typed handle for a plugin action UUID and its settings type S.

func NewAction

func NewAction[S any](c *Client, uuid string) *Action[S]

NewAction registers or returns the action for uuid. It panics if uuid is already registered with a different settings type.

func (*Action[S]) Client

func (a *Action[S]) Client() *Client

Client returns the parent client.

func (*Action[S]) Contexts

func (a *Action[S]) Contexts() []context.Context

Contexts returns the currently visible action-instance contexts.

func (*Action[S]) GetResources

func (a *Action[S]) GetResources(ctx context.Context) (map[string]string, error)

GetResources requests action resources and waits for the matching response.

func (*Action[S]) GetSettings

func (a *Action[S]) GetSettings(ctx context.Context) (S, error)

GetSettings requests action-instance settings and waits for the matching response.

func (*Action[S]) OnDialDown

func (a *Action[S]) OnDialDown(h func(context.Context, DialDownEvent[S]) error)

OnDialDown registers a dialDown handler.

func (*Action[S]) OnDialRotate

func (a *Action[S]) OnDialRotate(h func(context.Context, DialRotateEvent[S]) error)

OnDialRotate registers a dialRotate handler.

func (*Action[S]) OnDialUp

func (a *Action[S]) OnDialUp(h func(context.Context, DialUpEvent[S]) error)

OnDialUp registers a dialUp handler.

func (*Action[S]) OnDidReceiveResources

func (a *Action[S]) OnDidReceiveResources(h func(context.Context, DidReceiveResourcesEvent[S]) error)

OnDidReceiveResources registers a didReceiveResources handler for unsolicited updates.

func (*Action[S]) OnDidReceiveSettings

func (a *Action[S]) OnDidReceiveSettings(h func(context.Context, DidReceiveSettingsEvent[S]) error)

OnDidReceiveSettings registers a didReceiveSettings handler for unsolicited updates.

func (*Action[S]) OnKeyDown

func (a *Action[S]) OnKeyDown(h func(context.Context, KeyDownEvent[S]) error)

OnKeyDown registers a keyDown handler.

func (*Action[S]) OnKeyUp

func (a *Action[S]) OnKeyUp(h func(context.Context, KeyUpEvent[S]) error)

OnKeyUp registers a keyUp handler.

func (*Action[S]) OnPropertyInspectorDidAppear

func (a *Action[S]) OnPropertyInspectorDidAppear(h func(context.Context, PropertyInspectorDidAppearEvent[S]) error)

OnPropertyInspectorDidAppear registers a propertyInspectorDidAppear handler.

func (*Action[S]) OnPropertyInspectorDidDisappear

func (a *Action[S]) OnPropertyInspectorDidDisappear(h func(context.Context, PropertyInspectorDidDisappearEvent[S]) error)

OnPropertyInspectorDidDisappear registers a propertyInspectorDidDisappear handler.

func (*Action[S]) OnPropertyInspectorMessage

func (a *Action[S]) OnPropertyInspectorMessage[M any](h func(context.Context, M) error)

OnPropertyInspectorMessage registers a sendToPlugin handler with a message type independent of S.

func (*Action[S]) OnTitleParametersDidChange

func (a *Action[S]) OnTitleParametersDidChange(h func(context.Context, TitleParametersDidChangeEvent[S]) error)

OnTitleParametersDidChange registers a titleParametersDidChange handler.

func (*Action[S]) OnTouchTap

func (a *Action[S]) OnTouchTap(h func(context.Context, TouchTapEvent[S]) error)

OnTouchTap registers a touchTap handler.

func (*Action[S]) OnWillAppear

func (a *Action[S]) OnWillAppear(h func(context.Context, WillAppearEvent[S]) error)

OnWillAppear registers a willAppear handler.

func (*Action[S]) OnWillDisappear

func (a *Action[S]) OnWillDisappear(h func(context.Context, WillDisappearEvent[S]) error)

OnWillDisappear registers a willDisappear handler.

func (*Action[S]) RegisterHandler

func (a *Action[S]) RegisterHandler(event EventName, handler func(context.Context, Event) error)

RegisterHandler appends a raw handler for event. The handler list is copied on write so dispatch never holds the lock.

func (*Action[S]) SendToPropertyInspector

func (a *Action[S]) SendToPropertyInspector[M any](ctx context.Context, msg M) error

SendToPropertyInspector sends a typed message to the property inspector.

func (*Action[S]) SetFeedback

func (a *Action[S]) SetFeedback(ctx context.Context, payload Feedback) error

SetFeedback updates Stream Deck + layout items for the instance identified by ctx.

func (*Action[S]) SetFeedbackLayout

func (a *Action[S]) SetFeedbackLayout(ctx context.Context, layout string) error

SetFeedbackLayout sets the layout for the instance identified by ctx.

func (*Action[S]) SetImage

func (a *Action[S]) SetImage(ctx context.Context, base64image string, target Target, state ...int) error

SetImage changes the image of the action instance identified by ctx.

func (*Action[S]) SetResources

func (a *Action[S]) SetResources(ctx context.Context, resources map[string]string) error

SetResources stores files associated with the action instance.

func (*Action[S]) SetSettings

func (a *Action[S]) SetSettings(ctx context.Context, settings S) error

SetSettings persists action-instance settings.

func (*Action[S]) SetState

func (a *Action[S]) SetState(ctx context.Context, state int) error

SetState selects a multi-state action state.

func (*Action[S]) SetTitle

func (a *Action[S]) SetTitle(ctx context.Context, title string, target Target, state ...int) error

SetTitle changes the title of the action instance identified by ctx.

func (*Action[S]) ShowAlert

func (a *Action[S]) ShowAlert(ctx context.Context) error

ShowAlert shows a temporary alert icon.

func (*Action[S]) ShowOk

func (a *Action[S]) ShowOk(ctx context.Context) error

ShowOk shows a temporary OK icon.

func (*Action[S]) UUID

func (a *Action[S]) UUID() string

UUID returns the action UUID.

type ActionEvent

type ActionEvent[P any] struct {
	Action  string
	Context string
	Device  string
	ID      string
	Payload P
}

ActionEvent is a typed event bound to an action instance.

type ActionInfo

type ActionInfo[SettingsT any] struct {
	Action  string                       `json:"action"`
	Context string                       `json:"context"`
	Device  string                       `json:"device"`
	Payload ActionInfoPayload[SettingsT] `json:"payload"`
}

ActionInfo describes the selected action when a property inspector starts.

type ActionInfoPayload

type ActionInfoPayload[SettingsT any] struct {
	Coordinates Coordinates `json:"coordinates,omitempty"`
	Settings    SettingsT   `json:"settings,omitempty"`
}

ActionInfoPayload is the payload of a property inspector actionInfo object.

type Application

type Application struct {
	Font            string   `json:"font"`
	Language        Language `json:"language"`
	Platform        Platform `json:"platform"`
	PlatformVersion string   `json:"platformVersion"`
	Version         string   `json:"version"`
}

Application describes the Stream Deck application.

type ApplicationDidLaunchPayload

type ApplicationDidLaunchPayload struct {
	Application string `json:"application,omitempty"`
}

ApplicationDidLaunchPayload names a monitored application that launched.

type ApplicationDidTerminatePayload

type ApplicationDidTerminatePayload struct {
	Application string `json:"application,omitempty"`
}

ApplicationDidTerminatePayload names a monitored application that exited.

type BarFeedback

type BarFeedback struct {
	Background string         `json:"background,omitempty"`
	BarBgC     string         `json:"bar_bg_c,omitempty"`
	BarBorderC string         `json:"bar_border_c,omitempty"`
	BarFillC   string         `json:"bar_fill_c,omitempty"`
	BorderW    *int           `json:"border_w,omitempty"`
	Enabled    *bool          `json:"enabled,omitempty"`
	Opacity    *float64       `json:"opacity,omitempty"`
	Range      *FeedbackRange `json:"range,omitempty"`
	Subtype    *int           `json:"subtype,omitempty"`
	Value      *float64       `json:"value,omitempty"`
	ZOrder     *int           `json:"zOrder,omitempty"`
}

BarFeedback is a bar layout item.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client communicates with the Stream Deck application over WebSocket.

func NewClient

func NewClient(_ context.Context, params RegistrationParams, opts ...ClientOption) *Client

NewClient builds a client from Stream Deck registration parameters.

func (*Client) Close

func (c *Client) Close() error

Close closes the WebSocket. It is safe to call more than once.

func (*Client) GetGlobalSettings

func (c *Client) GetGlobalSettings[G any](ctx context.Context) (G, error)

GetGlobalSettings requests plugin-wide settings and waits for the matching response.

func (*Client) GetSecrets

func (c *Client) GetSecrets[G any](ctx context.Context) (G, error)

GetSecrets requests plugin secrets and waits for the matching response.

func (*Client) IsConnected

func (c *Client) IsConnected() bool

IsConnected reports whether the WebSocket is open.

func (*Client) LogMessage

func (c *Client) LogMessage(ctx context.Context, message string) error

LogMessage writes a debug line to the Stream Deck log file.

func (*Client) On

func (c *Client) On(event EventName, handler EventHandler)

On registers a handler for events that are not bound to an action UUID.

func (*Client) OnApplicationDidLaunch

func (c *Client) OnApplicationDidLaunch(h func(context.Context, ApplicationDidLaunchPayload) error)

OnApplicationDidLaunch registers a handler for applicationDidLaunch.

func (*Client) OnApplicationDidTerminate

func (c *Client) OnApplicationDidTerminate(h func(context.Context, ApplicationDidTerminatePayload) error)

OnApplicationDidTerminate registers a handler for applicationDidTerminate.

func (*Client) OnDeviceDidChange

func (c *Client) OnDeviceDidChange(h func(context.Context, DeviceEvent) error)

OnDeviceDidChange registers a handler for deviceDidChange.

func (*Client) OnDeviceDidConnect

func (c *Client) OnDeviceDidConnect(h func(context.Context, DeviceEvent) error)

OnDeviceDidConnect registers a handler for deviceDidConnect.

func (*Client) OnDeviceDidDisconnect

func (c *Client) OnDeviceDidDisconnect(h func(context.Context, DeviceEvent) error)

OnDeviceDidDisconnect registers a handler for deviceDidDisconnect.

func (c *Client) OnDidReceiveDeepLink(h func(context.Context, DidReceiveDeepLinkPayload) error)

OnDidReceiveDeepLink registers a handler for didReceiveDeepLink.

func (*Client) OnDidReceiveGlobalSettings

func (c *Client) OnDidReceiveGlobalSettings[G any](h func(context.Context, G) error)

OnDidReceiveGlobalSettings registers a handler for unsolicited global settings updates.

func (*Client) OnDidReceiveSecrets

func (c *Client) OnDidReceiveSecrets[G any](h func(context.Context, G) error)

OnDidReceiveSecrets registers a handler for didReceiveSecrets.

func (*Client) OnSystemDidWakeUp

func (c *Client) OnSystemDidWakeUp(h func(context.Context) error)

OnSystemDidWakeUp registers a handler for systemDidWakeUp.

func (*Client) OpenURL

func (c *Client) OpenURL(ctx context.Context, u url.URL) error

OpenURL opens a URL in the default browser.

func (*Client) Params

func (c *Client) Params() RegistrationParams

Params returns the registration parameters.

func (*Client) RegisterNoActionHandler

func (c *Client) RegisterNoActionHandler(event EventName, handler EventHandler)

RegisterNoActionHandler is an alias of On for events such as applicationDidLaunch.

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run connects to Stream Deck, registers, and dispatches events until the connection ends or ctx is cancelled. Stream Deck sends os.Interrupt (Ctrl+C) when the app shuts down or the plugin is uninstalled; Run listens for that in addition to ctx.

func (*Client) SetFeedback

func (c *Client) SetFeedback(ctx context.Context, payload Feedback) error

SetFeedback updates Stream Deck + layout items.

func (*Client) SetFeedbackLayout

func (c *Client) SetFeedbackLayout(ctx context.Context, layout string) error

SetFeedbackLayout sets the layout associated with an action instance.

func (*Client) SetGlobalSettings

func (c *Client) SetGlobalSettings[G any](ctx context.Context, settings G) error

SetGlobalSettings saves plugin-wide settings.

func (*Client) SetImage

func (c *Client) SetImage(ctx context.Context, base64image string, target Target, state ...int) error

SetImage changes the image of an action instance identified by ctx.

func (*Client) SetState

func (c *Client) SetState(ctx context.Context, state int) error

SetState selects a multi-state action state.

func (*Client) SetTitle

func (c *Client) SetTitle(ctx context.Context, title string, target Target, state ...int) error

SetTitle changes the title of an action instance identified by ctx.

func (*Client) SetTriggerDescription

func (c *Client) SetTriggerDescription(ctx context.Context, payload SetTriggerDescriptionPayload) error

SetTriggerDescription sets encoder trigger descriptions.

func (*Client) ShowAlert

func (c *Client) ShowAlert(ctx context.Context) error

ShowAlert shows a temporary alert icon on an action instance.

func (*Client) ShowOk

func (c *Client) ShowOk(ctx context.Context) error

ShowOk shows a temporary OK icon on an action instance.

func (*Client) SwitchToProfile

func (c *Client) SwitchToProfile(ctx context.Context, profile string, page ...int) error

SwitchToProfile switches to a plugin-distributed profile.

func (*Client) UUID

func (c *Client) UUID() string

UUID returns the plugin UUID supplied by Stream Deck.

type ClientOption

type ClientOption func(*Client)

ClientOption configures a Client.

func WithErrorHandler

func WithErrorHandler(h func(context.Context, error)) ClientOption

WithErrorHandler is called when an event handler returns an error.

func WithLogger

func WithLogger(logger *slog.Logger) ClientOption

WithLogger sets the client logger. The default logger discards output.

func WithQueueSize

func WithQueueSize(n int) ClientOption

WithQueueSize sets the initial per-context event buffer capacity. The mailbox grows if a handler is slower than incoming events (for example dialRotate bursts). Zero or negative uses the default.

func WithWebSocketURL

func WithWebSocketURL(u string) ClientOption

WithWebSocketURL overrides the Stream Deck WebSocket URL. Intended for tests.

type Colors

type Colors struct {
	ButtonPressedBackgroundColor   string `json:"buttonPressedBackgroundColor"`
	ButtonPressedBorderColor       string `json:"buttonPressedBorderColor"`
	ButtonPressedTextColor         string `json:"buttonPressedTextColor"`
	ButtonMouseOverBackgroundColor string `json:"buttonMouseOverBackgroundColor"`
	HighlightColor                 string `json:"highlightColor"`
}

Colors are the Stream Deck application's preferred colors.

type Controller

type Controller string

Controller identifies the input type of an action instance.

const (
	ControllerKeypad  Controller = "Keypad"
	ControllerEncoder Controller = "Encoder"
	ControllerNeo     Controller = "Neo"
)

type Coordinates

type Coordinates struct {
	Column int `json:"column"`
	Row    int `json:"row"`
}

Coordinates locate an action on a device grid.

type Device

type Device struct {
	ID   string     `json:"id"`
	Name string     `json:"name"`
	Size Size       `json:"size"`
	Type DeviceType `json:"type"`
}

Device is a device listed in registration info.

type DeviceEvent

type DeviceEvent struct {
	Device     string
	DeviceInfo DeviceInfo
}

DeviceEvent is a deviceDidConnect, deviceDidDisconnect, or deviceDidChange message.

type DeviceInfo

type DeviceInfo struct {
	Name string     `json:"name,omitempty"`
	Type DeviceType `json:"type,omitempty"`
	Size DeviceSize `json:"size,omitempty"`
}

DeviceInfo describes a Stream Deck device.

type DeviceSize

type DeviceSize struct {
	Columns int `json:"columns,omitempty"`
	Rows    int `json:"rows,omitempty"`
}

DeviceSize is the key grid size of a device, excluding dials and touchscreens.

type DeviceType

type DeviceType int

DeviceType is a Stream Deck hardware type. See https://github.com/elgatosf/schemas/blob/main/src/streamdeck/plugins/device-type.ts

const (
	StreamDeck        DeviceType = 0
	StreamDeckMini    DeviceType = 1
	StreamDeckXL      DeviceType = 2
	StreamDeckMobile  DeviceType = 3
	CorsairGKeys      DeviceType = 4
	StreamDeckPedal   DeviceType = 5
	CorsairVoyager    DeviceType = 6
	StreamDeckPlus    DeviceType = 7
	SCUFController    DeviceType = 8
	StreamDeckNeo     DeviceType = 9
	StreamDeckStudio  DeviceType = 10
	VirtualStreamDeck DeviceType = 11
	Galleon100SD      DeviceType = 12
	StreamDeckPlusXL  DeviceType = 13
)

type DialDownEvent

type DialDownEvent[S any] = ActionEvent[DialDownPayload[S]]

type DialDownPayload

type DialDownPayload[T any] struct {
	Settings    T                 `json:"settings,omitempty"`
	Coordinates *Coordinates      `json:"coordinates,omitempty"`
	Controller  Controller        `json:"controller,omitempty"`
	Resources   map[string]string `json:"resources,omitempty"`
}

DialDownPayload is sent when a Stream Deck + dial is pressed.

type DialRotateEvent

type DialRotateEvent[S any] = ActionEvent[DialRotatePayload[S]]

type DialRotatePayload

type DialRotatePayload[T any] struct {
	Settings    T                 `json:"settings,omitempty"`
	Coordinates *Coordinates      `json:"coordinates,omitempty"`
	Ticks       int               `json:"ticks,omitempty"`
	Pressed     bool              `json:"pressed,omitempty"`
	Controller  Controller        `json:"controller,omitempty"`
	Resources   map[string]string `json:"resources,omitempty"`
}

DialRotatePayload is sent when a Stream Deck + dial is rotated.

type DialUpEvent

type DialUpEvent[S any] = ActionEvent[DialUpPayload[S]]

type DialUpPayload

type DialUpPayload[T any] struct {
	Settings    T                 `json:"settings,omitempty"`
	Coordinates *Coordinates      `json:"coordinates,omitempty"`
	Controller  Controller        `json:"controller,omitempty"`
	Resources   map[string]string `json:"resources,omitempty"`
}

DialUpPayload is sent when a Stream Deck + dial is released.

type DidReceiveDeepLinkPayload

type DidReceiveDeepLinkPayload struct {
	URL string `json:"url,omitempty"`
}

DidReceiveDeepLinkPayload contains a deep-link path with the prefix omitted.

type DidReceiveGlobalSettingsPayload

type DidReceiveGlobalSettingsPayload[T any] struct {
	Settings T `json:"settings,omitempty"`
}

DidReceiveGlobalSettingsPayload contains plugin-wide settings.

type DidReceiveResourcesEvent

type DidReceiveResourcesEvent[S any] = ActionEvent[DidReceiveResourcesPayload[S]]

type DidReceiveResourcesPayload

type DidReceiveResourcesPayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	IsInMultiAction bool              `json:"isInMultiAction,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
	State           *int              `json:"state,omitempty"`
}

DidReceiveResourcesPayload is returned for getResources and resource edits.

type DidReceiveSecretsPayload

type DidReceiveSecretsPayload[T any] struct {
	Secrets T `json:"secrets,omitempty"`
}

DidReceiveSecretsPayload contains plugin secrets.

type DidReceiveSettingsEvent

type DidReceiveSettingsEvent[S any] = ActionEvent[DidReceiveSettingsPayload[S]]

type DidReceiveSettingsPayload

type DidReceiveSettingsPayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	IsInMultiAction bool              `json:"isInMultiAction,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
	State           *int              `json:"state,omitempty"`
}

DidReceiveSettingsPayload is returned for getSettings and property inspector edits.

type Event

type Event struct {
	Action     string          `json:"action,omitempty"`
	Event      EventName       `json:"event,omitempty"`
	UUID       string          `json:"uuid,omitempty"`
	Context    string          `json:"context,omitempty"`
	Device     string          `json:"device,omitempty"`
	DeviceInfo DeviceInfo      `json:"deviceInfo,omitempty"`
	ID         string          `json:"id,omitempty"`
	Payload    json.RawMessage `json:"payload,omitempty"`
}

Event is a received Stream Deck WebSocket message.

func (Event) Unmarshal

func (e Event) Unmarshal[T any]() (T, error)

Unmarshal decodes the event payload as T.

type EventHandler

type EventHandler func(ctx context.Context, client *Client, event Event) error

EventHandler handles a received event that is not bound to a registered action.

type EventName

type EventName string

EventName is a Stream Deck WebSocket event or command name.

const (
	DidReceiveSettings            EventName = "didReceiveSettings"
	DidReceiveGlobalSettings      EventName = "didReceiveGlobalSettings"
	DidReceiveResources           EventName = "didReceiveResources"
	DidReceiveSecrets             EventName = "didReceiveSecrets"
	DidReceiveDeepLink            EventName = "didReceiveDeepLink"
	KeyDown                       EventName = "keyDown"
	KeyUp                         EventName = "keyUp"
	TouchTap                      EventName = "touchTap"
	DialDown                      EventName = "dialDown"
	DialUp                        EventName = "dialUp"
	DialRotate                    EventName = "dialRotate"
	WillAppear                    EventName = "willAppear"
	WillDisappear                 EventName = "willDisappear"
	TitleParametersDidChange      EventName = "titleParametersDidChange"
	DeviceDidConnect              EventName = "deviceDidConnect"
	DeviceDidDisconnect           EventName = "deviceDidDisconnect"
	DeviceDidChange               EventName = "deviceDidChange"
	ApplicationDidLaunch          EventName = "applicationDidLaunch"
	ApplicationDidTerminate       EventName = "applicationDidTerminate"
	SystemDidWakeUp               EventName = "systemDidWakeUp"
	PropertyInspectorDidAppear    EventName = "propertyInspectorDidAppear"
	PropertyInspectorDidDisappear EventName = "propertyInspectorDidDisappear"
	SendToPlugin                  EventName = "sendToPlugin"
	SendToPropertyInspector       EventName = "sendToPropertyInspector"

	SetSettings           EventName = "setSettings"
	GetSettings           EventName = "getSettings"
	SetGlobalSettings     EventName = "setGlobalSettings"
	GetGlobalSettings     EventName = "getGlobalSettings"
	GetResources          EventName = "getResources"
	SetResources          EventName = "setResources"
	GetSecrets            EventName = "getSecrets"
	OpenURL               EventName = "openUrl"
	LogMessage            EventName = "logMessage"
	SetTitle              EventName = "setTitle"
	SetImage              EventName = "setImage"
	SetFeedback           EventName = "setFeedback"
	SetFeedbackLayout     EventName = "setFeedbackLayout"
	SetTriggerDescription EventName = "setTriggerDescription"
	ShowAlert             EventName = "showAlert"
	ShowOk                EventName = "showOk"
	SetState              EventName = "setState"
	SwitchToProfile       EventName = "switchToProfile"
)

type Feedback

type Feedback map[string]FeedbackValue

Feedback updates Stream Deck + layout items by id.

func (Feedback) MarshalJSON

func (f Feedback) MarshalJSON() ([]byte, error)

type FeedbackFont

type FeedbackFont struct {
	Size   *int `json:"size,omitempty"`
	Weight *int `json:"weight,omitempty"`
}

FeedbackFont is a text item font.

type FeedbackNumber

type FeedbackNumber float64

FeedbackNumber is a shorthand numeric layout value.

type FeedbackRange

type FeedbackRange struct {
	Min float64 `json:"min"`
	Max float64 `json:"max"`
}

FeedbackRange is a min/max pair for bar and gauge items.

type FeedbackString

type FeedbackString string

FeedbackString is a shorthand string layout value.

type FeedbackValue

type FeedbackValue interface {
	// contains filtered or unexported methods
}

FeedbackValue is a setFeedback item: a string, number, or typed layout object.

type GaugeBarFeedback

type GaugeBarFeedback struct {
	Background string         `json:"background,omitempty"`
	BarBgC     string         `json:"bar_bg_c,omitempty"`
	BarBorderC string         `json:"bar_border_c,omitempty"`
	BarFillC   string         `json:"bar_fill_c,omitempty"`
	BarH       *int           `json:"bar_h,omitempty"`
	BorderW    *int           `json:"border_w,omitempty"`
	Enabled    *bool          `json:"enabled,omitempty"`
	Opacity    *float64       `json:"opacity,omitempty"`
	Range      *FeedbackRange `json:"range,omitempty"`
	Subtype    *int           `json:"subtype,omitempty"`
	Value      *float64       `json:"value,omitempty"`
	ZOrder     *int           `json:"zOrder,omitempty"`
}

GaugeBarFeedback is a gauge-bar layout item.

type Info

type Info struct {
	Application      Application `json:"application"`
	Plugin           Plugin      `json:"plugin"`
	DevicePixelRatio int         `json:"devicePixelRatio"`
	Colors           Colors      `json:"colors"`
	Devices          []Device    `json:"devices"`
}

Info is the registration -info JSON object.

type KeyDownEvent

type KeyDownEvent[S any] = ActionEvent[KeyDownPayload[S]]

type KeyDownPayload

type KeyDownPayload[T any] struct {
	Settings         T                 `json:"settings,omitempty"`
	Coordinates      *Coordinates      `json:"coordinates,omitempty"`
	State            *int              `json:"state,omitempty"`
	UserDesiredState *int              `json:"userDesiredState,omitempty"`
	IsInMultiAction  bool              `json:"isInMultiAction,omitempty"`
	Controller       Controller        `json:"controller,omitempty"`
	Resources        map[string]string `json:"resources,omitempty"`
}

KeyDownPayload is sent when a key is pressed.

type KeyUpEvent

type KeyUpEvent[S any] = ActionEvent[KeyUpPayload[S]]

type KeyUpPayload

type KeyUpPayload[T any] struct {
	Settings         T                 `json:"settings,omitempty"`
	Coordinates      *Coordinates      `json:"coordinates,omitempty"`
	State            *int              `json:"state,omitempty"`
	UserDesiredState *int              `json:"userDesiredState,omitempty"`
	IsInMultiAction  bool              `json:"isInMultiAction,omitempty"`
	Controller       Controller        `json:"controller,omitempty"`
	Resources        map[string]string `json:"resources,omitempty"`
}

KeyUpPayload is sent when a key is released.

type Language

type Language string

Language is a Stream Deck application locale.

const (
	LanguageDE   Language = "de"
	LanguageEN   Language = "en"
	LanguageES   Language = "es"
	LanguageFR   Language = "fr"
	LanguageJA   Language = "ja"
	LanguageKO   Language = "ko"
	LanguageZHCN Language = "zh_CN"
	LanguageZHTW Language = "zh_TW"
)

type LogMessagePayload

type LogMessagePayload struct {
	Message string `json:"message"`
}

LogMessagePayload is written to the Stream Deck log file.

type OpenURLPayload

type OpenURLPayload struct {
	URL string `json:"url"`
}

OpenURLPayload opens a URL in the default browser.

type PixmapFeedback

type PixmapFeedback struct {
	Background string   `json:"background,omitempty"`
	Enabled    *bool    `json:"enabled,omitempty"`
	Opacity    *float64 `json:"opacity,omitempty"`
	Value      string   `json:"value,omitempty"`
	ZOrder     *int     `json:"zOrder,omitempty"`
}

PixmapFeedback is an image layout item.

type Platform

type Platform string

Platform is the host operating system reported by Stream Deck.

const (
	PlatformMac     Platform = "mac"
	PlatformWindows Platform = "windows"
)

type Plugin

type Plugin struct {
	UUID    string `json:"uuid"`
	Version string `json:"version"`
}

Plugin describes the running plugin.

type PropertyInspectorDidAppearEvent

type PropertyInspectorDidAppearEvent[S any] = ActionEvent[PropertyInspectorDidAppearPayload[S]]

type PropertyInspectorDidAppearPayload

type PropertyInspectorDidAppearPayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	State           *int              `json:"state,omitempty"`
	IsInMultiAction bool              `json:"isInMultiAction,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
}

PropertyInspectorDidAppearPayload is sent when the property inspector opens.

type PropertyInspectorDidDisappearEvent

type PropertyInspectorDidDisappearEvent[S any] = ActionEvent[PropertyInspectorDidDisappearPayload[S]]

type PropertyInspectorDidDisappearPayload

type PropertyInspectorDidDisappearPayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	State           *int              `json:"state,omitempty"`
	IsInMultiAction bool              `json:"isInMultiAction,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
}

PropertyInspectorDidDisappearPayload is sent when the property inspector closes.

type RegistrationParams

type RegistrationParams struct {
	Port          int
	PluginUUID    string
	RegisterEvent string
	Info          Info
}

RegistrationParams are the command-line values Stream Deck passes to a plugin.

func ParseRegistrationParams

func ParseRegistrationParams(args []string) (RegistrationParams, error)

ParseRegistrationParams parses Stream Deck launch arguments. Pass os.Args.

type SetFeedbackLayoutPayload

type SetFeedbackLayoutPayload struct {
	Layout string `json:"layout"`
}

SetFeedbackLayoutPayload selects a Stream Deck + layout.

type SetImagePayload

type SetImagePayload struct {
	Base64Image string `json:"image,omitempty"`
	Target      Target `json:"target,omitempty"`
	State       *int   `json:"state,omitempty"`
}

SetImagePayload updates the image of an action instance.

type SetStatePayload

type SetStatePayload struct {
	State int `json:"state"`
}

SetStatePayload selects a multi-state action state.

type SetTitlePayload

type SetTitlePayload struct {
	Title  string `json:"title,omitempty"`
	Target Target `json:"target,omitempty"`
	State  *int   `json:"state,omitempty"`
}

SetTitlePayload updates the title of an action instance.

type SetTriggerDescriptionPayload

type SetTriggerDescriptionPayload struct {
	LongTouch string `json:"longTouch,omitempty"`
	Push      string `json:"push,omitempty"`
	Rotate    string `json:"rotate,omitempty"`
	Touch     string `json:"touch,omitempty"`
}

SetTriggerDescriptionPayload updates encoder trigger descriptions.

type Size

type Size struct {
	Columns int `json:"columns"`
	Rows    int `json:"rows"`
}

Size is a device grid size.

type SwitchProfilePayload

type SwitchProfilePayload struct {
	Profile string `json:"profile,omitempty"`
	Page    *int   `json:"page,omitempty"`
}

SwitchProfilePayload switches to a plugin-distributed profile.

type Target

type Target int

Target specifies whether a title or image update applies to hardware, software, or both.

const (
	HardwareAndSoftware Target = iota
	OnlyHardware
	OnlySoftware
)

type TextAlignment

type TextAlignment string

TextAlignment is a setFeedback text alignment.

const (
	TextAlignCenter TextAlignment = "center"
	TextAlignLeft   TextAlignment = "left"
	TextAlignRight  TextAlignment = "right"
)

type TextFeedback

type TextFeedback struct {
	Alignment    TextAlignment `json:"alignment,omitempty"`
	Background   string        `json:"background,omitempty"`
	Color        string        `json:"color,omitempty"`
	Enabled      *bool         `json:"enabled,omitempty"`
	Font         *FeedbackFont `json:"font,omitempty"`
	Opacity      *float64      `json:"opacity,omitempty"`
	TextOverflow TextOverflow  `json:"text-overflow,omitempty"`
	Value        string        `json:"value,omitempty"`
	ZOrder       *int          `json:"zOrder,omitempty"`
}

TextFeedback is a text layout item.

type TextOverflow

type TextOverflow string

TextOverflow is a setFeedback text overflow mode.

const (
	TextOverflowClip     TextOverflow = "clip"
	TextOverflowEllipsis TextOverflow = "ellipsis"
	TextOverflowFade     TextOverflow = "fade"
)

type TitleParameters

type TitleParameters struct {
	FontFamily     string `json:"fontFamily,omitempty"`
	FontSize       int    `json:"fontSize,omitempty"`
	FontStyle      string `json:"fontStyle,omitempty"`
	FontUnderline  bool   `json:"fontUnderline,omitempty"`
	ShowTitle      bool   `json:"showTitle,omitempty"`
	TitleAlignment string `json:"titleAlignment,omitempty"`
	TitleColor     string `json:"titleColor,omitempty"`
}

TitleParameters describes how a title is rendered.

type TitleParametersDidChangeEvent

type TitleParametersDidChangeEvent[S any] = ActionEvent[TitleParametersDidChangePayload[S]]

type TitleParametersDidChangePayload

type TitleParametersDidChangePayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	State           *int              `json:"state,omitempty"`
	Title           string            `json:"title,omitempty"`
	TitleParameters TitleParameters   `json:"titleParameters,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
}

TitleParametersDidChangePayload is sent when the user edits title parameters.

type TouchTapEvent

type TouchTapEvent[S any] = ActionEvent[TouchTapPayload[S]]

type TouchTapPayload

type TouchTapPayload[T any] struct {
	Settings    T                 `json:"settings,omitempty"`
	Coordinates *Coordinates      `json:"coordinates,omitempty"`
	TapPos      [2]int            `json:"tapPos,omitempty"`
	Hold        bool              `json:"hold,omitempty"`
	Controller  Controller        `json:"controller,omitempty"`
	Resources   map[string]string `json:"resources,omitempty"`
}

TouchTapPayload is sent when a Stream Deck + touchscreen is tapped.

type WillAppearEvent

type WillAppearEvent[S any] = ActionEvent[WillAppearPayload[S]]

type WillAppearPayload

type WillAppearPayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	State           *int              `json:"state,omitempty"`
	IsInMultiAction bool              `json:"isInMultiAction,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
}

WillAppearPayload is sent when an action instance becomes visible.

type WillDisappearEvent

type WillDisappearEvent[S any] = ActionEvent[WillDisappearPayload[S]]

type WillDisappearPayload

type WillDisappearPayload[T any] struct {
	Settings        T                 `json:"settings,omitempty"`
	Coordinates     *Coordinates      `json:"coordinates,omitempty"`
	State           *int              `json:"state,omitempty"`
	IsInMultiAction bool              `json:"isInMultiAction,omitempty"`
	Controller      Controller        `json:"controller,omitempty"`
	Resources       map[string]string `json:"resources,omitempty"`
}

WillDisappearPayload is sent when an action instance is hidden.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL