Documentation
¶
Index ¶
- Variables
- func DispatchEvent(event StreamDeckEvent)
- func HandleEvent(data []byte)
- func RegisterAction(action Action)
- func SendEventToStreamDeck(response interface{}) error
- func StartPlugin()
- type Action
- type ActionAssociatedEvent
- func (e *ActionAssociatedEvent) GetAction() (string, bool)
- func (e *ActionAssociatedEvent) GetContext() string
- func (e *ActionAssociatedEvent) GetEventType() string
- func (e *ActionAssociatedEvent) GetGlobalSettings() (GlobalSettings, error)
- func (e *ActionAssociatedEvent) GetSettings() (ActionSettings, error)
- func (e *ActionAssociatedEvent) IsActionAssociated() bool
- func (e *ActionAssociatedEvent) LogMessage(message string) error
- func (e *ActionAssociatedEvent) OpenUrl(url string) error
- func (e *ActionAssociatedEvent) SendToPropertyInspector(payload map[string]any) error
- func (e *ActionAssociatedEvent) SetGlobalSettings(settings map[string]any) error
- func (e *ActionAssociatedEvent) SetImage(base64image string, options ...uint8) error
- func (e *ActionAssociatedEvent) SetSettings(settings map[string]any) error
- func (e *ActionAssociatedEvent) SetState(state uint8) error
- func (e *ActionAssociatedEvent) SetTitle(title string, options ...uint8) error
- func (e *ActionAssociatedEvent) ShowAlert() error
- func (e *ActionAssociatedEvent) ShowOk() error
- func (e *ActionAssociatedEvent) SwitchToProfile(profile string, page ...uint8) error
- type ActionConfig
- type ActionCoordinates
- type ActionSettings
- type ApplicationDidLaunchEvent
- type ApplicationDidTerminateEvent
- type DeviceDidConnectEvent
- type DeviceDidDisconnectEvent
- type DialDownEvent
- type DialRotateEvent
- type DialUpEvent
- type DidReceiveDeepLinkEvent
- type DidReceiveGlobalSettingsEvent
- type DidReceiveSettingsEvent
- type GetGlobalSettingsCommand
- type GetSettingsCommand
- type GlobalEvent
- type GlobalSettings
- type KeyDownEvent
- type KeyUpEvent
- type LogMessageCommand
- type OpenUrlCommand
- type PluginConfigType
- type PropertyInspectorDidAppearEvent
- type PropertyInspectorDidDisappearEvent
- type ResponseChannel
- type SendToPluginEvent
- type SendToPluginFromPluginEvent
- type SendToPropertyInspectorEvent
- type SendToPropertyInspectorFromPluginCommand
- type SetFeedbackEvent
- type SetFeedbackLayoutEvent
- type SetGlobalSettingsCommand
- type SetImageCommand
- type SetSettingsCommand
- type SetStateCommand
- type SetTitleCommand
- type SetTriggerDescriptionEvent
- type ShowAlertCommand
- type ShowOkCommand
- type StreamDeckEvent
- type StreamDeckInfo
- type SwitchToProfileCommand
- type SystemDidWakeUpEvent
- type TapPosition
- type TitleParametersDidChangeEvent
- type TouchTapEvent
- type WillAppearEvent
- type WillDisappearEvent
Constants ¶
This section is empty.
Variables ¶
var WsClient *websocket.Conn
Functions ¶
func DispatchEvent ¶
func DispatchEvent(event StreamDeckEvent)
func HandleEvent ¶
func HandleEvent(data []byte)
func RegisterAction ¶
func RegisterAction(action Action)
func SendEventToStreamDeck ¶
func SendEventToStreamDeck(response interface{}) error
func StartPlugin ¶
func StartPlugin()
Types ¶
type ActionAssociatedEvent ¶
type ActionAssociatedEvent struct { Event string `json:"event"` Action string `json:"action"` Context string `json:"context"` Device string `json:"device,omitempty"` }
func (*ActionAssociatedEvent) GetAction ¶
func (e *ActionAssociatedEvent) GetAction() (string, bool)
func (*ActionAssociatedEvent) GetContext ¶ added in v0.2.0
func (e *ActionAssociatedEvent) GetContext() string
func (*ActionAssociatedEvent) GetEventType ¶
func (e *ActionAssociatedEvent) GetEventType() string
func (*ActionAssociatedEvent) GetGlobalSettings ¶ added in v0.2.0
func (e *ActionAssociatedEvent) GetGlobalSettings() (GlobalSettings, error)
Gets the global settings associated with the plugin. Causes DidReceiveGlobalSettings to be emitted.
Usage:
globalSettings, err := e.GetGlobalSettings()
Docs: https://docs.elgato.com/sdk/plugins/events-sent#getglobalsettings
func (*ActionAssociatedEvent) GetSettings ¶
func (e *ActionAssociatedEvent) GetSettings() (ActionSettings, error)
Gets the settings associated with an instance of an action. Causes DidReceiveSettings to be emitted.
Usage:
settings, err := e.GetSettings()
Docs: https://docs.elgato.com/sdk/plugins/events-sent#getsettings
func (*ActionAssociatedEvent) IsActionAssociated ¶
func (e *ActionAssociatedEvent) IsActionAssociated() bool
func (*ActionAssociatedEvent) LogMessage ¶
func (e *ActionAssociatedEvent) LogMessage(message string) error
Logs a message to the file-system.
Usage:
e.LogMessage("Button was clicked!")
Docs: https://docs.elgato.com/sdk/plugins/events-sent#logmessage
func (*ActionAssociatedEvent) OpenUrl ¶
func (e *ActionAssociatedEvent) OpenUrl(url string) error
Opens the URL in the user's default browser.
Usage:
e.OpenUrl("https://www.example.com")
Docs: https://docs.elgato.com/sdk/plugins/events-sent#openurl
func (*ActionAssociatedEvent) SendToPropertyInspector ¶
func (e *ActionAssociatedEvent) SendToPropertyInspector(payload map[string]any) error
Sends a message to the property inspector.
Usage:
e.SetState(map[string]any{}{ "arbitrary": "value", })
Docs: https://docs.elgato.com/sdk/plugins/events-sent#sendtopropertyinspector
func (*ActionAssociatedEvent) SetGlobalSettings ¶ added in v0.2.0
func (e *ActionAssociatedEvent) SetGlobalSettings(settings map[string]any) error
Update settings associated with action The plugin and Property Inspector can save persistent data globally. The data will be saved securely to the Keychain on macOS and the Credential Store on Windows. This API can be used to save tokens that should be available to every action in the plugin.
Parameters: - settings: A map[string]any which is persistently saved persistently saved globally.
Usage:
newSettings := map[string]any{ "apikey": "mX8ulcBHYmMniSshmB59" } e.setGlobalSettings(newSettings)
Docs: https://docs.elgato.com/sdk/plugins/events-sent#setglobalsettings
func (*ActionAssociatedEvent) SetImage ¶
func (e *ActionAssociatedEvent) SetImage(base64image string, options ...uint8) error
Sets the image associated with an action instance.
Usage:
e.SetImage("Button was clicked!")
Docs: https://docs.elgato.com/sdk/plugins/events-sent#setimage
func (*ActionAssociatedEvent) SetSettings ¶
func (e *ActionAssociatedEvent) SetSettings(settings map[string]any) error
Sets the settings associated with an instance of an action. Parameters: - settings: A map[string]any which is persistently saved as a json for the action's instance.
Usage:
newSettings := map[string]any{ "apikey": "mX8ulcBHYmMniSshmB59" } e.SetSettings(newSettings)
Docs: https://docs.elgato.com/sdk/plugins/events-sent#setsettings
func (*ActionAssociatedEvent) SetState ¶
func (e *ActionAssociatedEvent) SetState(state uint8) error
Sets the current state of an action instance.
Usage:
e.SetState(1)
Docs: https://docs.elgato.com/sdk/plugins/events-sent#setstate
func (*ActionAssociatedEvent) SetTitle ¶
func (e *ActionAssociatedEvent) SetTitle(title string, options ...uint8) error
Sets the title displayed for an instance of an action.
Parameters:
- title: The new title to be displayed on the button.
- options: Optional integers where the first value is the target and the second is the state. Both default to 0 if not provided.
Usage:
e.SetTitle("New Title") // Default target and state e.SetTitle("New Title", 1) // Specified target, default state e.SetTitle("New Title", 1, 2) // Specified target and state
Docs: https://docs.elgato.com/sdk/plugins/events-sent#settitle
func (*ActionAssociatedEvent) ShowAlert ¶
func (e *ActionAssociatedEvent) ShowAlert() error
Temporarily shows an alert (i.e. warning), in the form of an exclamation mark in a yellow triangle, on the action instance. Used to provide visual feedback when an action failed.
Usage:
e.ShowAlert()
Docs: https://docs.elgato.com/sdk/plugins/events-sent#showalert
func (*ActionAssociatedEvent) ShowOk ¶
func (e *ActionAssociatedEvent) ShowOk() error
Temporarily shows an "OK" (i.e. success), in the form of a check-mark in a green circle, on the action instance. Used to provide visual feedback when an action successfully executed.
Usage:
e.ShowOk()
Docs: https://docs.elgato.com/sdk/plugins/events-sent#showok
func (*ActionAssociatedEvent) SwitchToProfile ¶ added in v0.2.0
func (e *ActionAssociatedEvent) SwitchToProfile(profile string, page ...uint8) error
Switches to the profile, as distributed by the plugin, on the specified device.
NB: Plugins may only switch to profiles distributed with the plugin, as defined within the manifest, and cannot access user-defined profiles.
Usage:
e.SwitchToProfile("MyPluginProfile") e.SwitchToProfile("MyPluginProfile", 1)
Docs: https://docs.elgato.com/sdk/plugins/events-sent#switchtoprofile
type ActionConfig ¶
type ActionConfig struct {
UUID string
}
func (*ActionConfig) GetUUID ¶
func (a *ActionConfig) GetUUID() string
type ActionCoordinates ¶
type ActionSettings ¶
type ApplicationDidLaunchEvent ¶
type ApplicationDidLaunchEvent struct { GlobalEvent Payload struct { Application string `json:"application"` } `json:"payload"` }
type ApplicationDidTerminateEvent ¶
type ApplicationDidTerminateEvent struct { GlobalEvent Payload struct { Application string `json:"application"` } `json:"payload"` }
type DeviceDidConnectEvent ¶
type DeviceDidConnectEvent struct { GlobalEvent DeviceInfo struct { Name string `json:"name"` Type int `json:"type"` Size struct { Columns int `json:"columns"` Rows int `json:"rows"` } `json:"size"` } `json:"deviceInfo"` }
type DeviceDidDisconnectEvent ¶
type DeviceDidDisconnectEvent struct {
GlobalEvent
}
type DialDownEvent ¶
type DialDownEvent struct { ActionAssociatedEvent Payload struct { Controller string `json:"controller"` Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` } `json:"payload"` }
type DialRotateEvent ¶
type DialRotateEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Controller string `json:"controller"` Coordinates ActionCoordinates `json:"coordinates"` Ticks int `json:"ticks"` Pressed bool `json:"pressed"` } `json:"payload"` }
type DialUpEvent ¶
type DialUpEvent struct { ActionAssociatedEvent Payload struct { Controller string `json:"controller"` Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` } `json:"payload"` }
type DidReceiveDeepLinkEvent ¶
type DidReceiveDeepLinkEvent struct { GlobalEvent Payload struct { Url string `json:"url"` } `json:"payload"` }
type DidReceiveGlobalSettingsEvent ¶
type DidReceiveGlobalSettingsEvent struct { GlobalEvent Payload struct { Settings GlobalSettings `json:"settings"` } `json:"payload"` }
type DidReceiveSettingsEvent ¶
type DidReceiveSettingsEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` IsInMultiAction bool `json:"isInMultiAction"` } `json:"payload"` }
type GetGlobalSettingsCommand ¶ added in v0.3.0
type GetSettingsCommand ¶ added in v0.3.0
type GlobalEvent ¶
func (*GlobalEvent) GetEventType ¶
func (e *GlobalEvent) GetEventType() string
func (*GlobalEvent) IsActionAssociated ¶
func (e *GlobalEvent) IsActionAssociated() bool
type GlobalSettings ¶
func GetGlobalSettings ¶ added in v0.3.0
func GetGlobalSettings() (GlobalSettings, error)
type KeyDownEvent ¶
type KeyDownEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` State int `json:"states"` UserDesiredState int `json:"userDesiredState"` IsInMultiAction bool `json:"isInMultiAction"` } `json:"payload"` }
type KeyUpEvent ¶
type KeyUpEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` State int `json:"state"` UserDesiredState int `json:"userDesiredState"` IsInMultiAction bool `json:"isInMultiAction"` } `json:"payload"` }
type LogMessageCommand ¶ added in v0.3.0
type OpenUrlCommand ¶ added in v0.3.0
type PluginConfigType ¶
type PluginConfigType struct { Port string PluginUUID string RegisterEvent string Info StreamDeckInfo }
PluginConfig holds the configuration passed via flags
var PluginConfig PluginConfigType
type PropertyInspectorDidAppearEvent ¶
type PropertyInspectorDidAppearEvent struct {
ActionAssociatedEvent
}
type PropertyInspectorDidDisappearEvent ¶
type PropertyInspectorDidDisappearEvent struct {
ActionAssociatedEvent
}
type ResponseChannel ¶ added in v0.2.0
type ResponseChannel chan StreamDeckEvent
type SendToPluginEvent ¶
type SendToPluginEvent struct { ActionAssociatedEvent Payload map[string]any `json:"payload"` }
type SendToPropertyInspectorEvent ¶
type SendToPropertyInspectorEvent struct { ActionAssociatedEvent Payload map[string]any `json:"payload"` }
type SendToPropertyInspectorFromPluginCommand ¶ added in v0.3.0
type SendToPropertyInspectorFromPluginCommand struct { Action string `json:"action"` Event string `json:"event"` Context string `json:"context"` Payload map[string]any `json:"payload"` }
Both of these events might not even be necessary
type SetFeedbackEvent ¶
type SetFeedbackLayoutEvent ¶
type SetGlobalSettingsCommand ¶ added in v0.3.0
type SetImageCommand ¶ added in v0.3.0
type SetSettingsCommand ¶ added in v0.3.0
type SetStateCommand ¶ added in v0.3.0
type SetTitleCommand ¶ added in v0.3.0
type ShowAlertCommand ¶ added in v0.3.0
type ShowOkCommand ¶ added in v0.3.0
type StreamDeckEvent ¶
func ParseEvent ¶
func ParseEvent(data []byte) (StreamDeckEvent, error)
type StreamDeckInfo ¶
type StreamDeckInfo struct { Application struct { Font string `json:"font"` Platform string `json:"platform"` PlatformVersion string `json:"platformVersion"` Version string `json:"version"` } `json:"application"` Plugin struct { UUID string `json:"uuid"` Version string `json:"version"` } `json:"plugin"` DevicePixelRatio int `json:"devicePixelRatio"` Colors struct { ButtonPressedBackgroundColor string `json:"buttonPressedBackgroundColor"` ButtonPressedBorderColor string `json:"buttonPressedBorderColor"` ButtonPressedTextColor string `json:"buttonPressedTextColor"` DisabledColor string `json:"disabledColor"` HighlightColor string `json:"highlightColor"` MouseDownColor string `json:"mouseDownColor"` } `json:"colors"` Device []struct { Id string `json:"id"` Name string `json:"name"` Size struct { Columns int `json:"columns"` Rows string `json:"rows"` } `json:"device"` Type int `json:"type"` } `json:"devices"` }
StreamDeckInfo holds the parsed JSON data from the -info flag
type SwitchToProfileCommand ¶ added in v0.3.0
type SystemDidWakeUpEvent ¶
type SystemDidWakeUpEvent struct {
GlobalEvent
}
type TapPosition ¶
type TapPosition [2]int
type TitleParametersDidChangeEvent ¶
type TitleParametersDidChangeEvent struct { ActionAssociatedEvent Payload struct { Coordinates ActionCoordinates `json:"coordinates"` Settings ActionSettings `json:"settings"` State int `json:"state"` Title string `json:"title"` TitleParameters struct { FontFamily string `json:"fontFamily"` FontSize int `json:"fontSize"` FontStyle string `json:"fontStyle"` FontUnderline bool `json:"fontUnderline"` ShowTitle bool `json:"showTitle"` TitleAlignment string `json:"titleAlignment"` TitleColor string `json:"titleColor"` } `json:"titleParameters"` } `json:"payload"` }
type TouchTapEvent ¶
type TouchTapEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Controller string `json:"controller"` Coordinates ActionCoordinates `json:"coordinates"` TapPos TapPosition `json:"tapPos"` Hold bool `json:"hold"` } `json:"payload"` }
type WillAppearEvent ¶
type WillAppearEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` Controller string `json:"controller"` State int `json:"state"` IsInMultiAction bool `json:"isInMultiAction"` } `json:"payload"` }
type WillDisappearEvent ¶
type WillDisappearEvent struct { ActionAssociatedEvent Payload struct { Settings ActionSettings `json:"settings"` Coordinates ActionCoordinates `json:"coordinates"` Controller string `json:"controller"` State int `json:"state"` IsInMultiAction bool `json:"isInMultiAction"` } `json:"payload"` }