api

package module
v2.0.17 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: BSD-3-Clause Imports: 30 Imported by: 3

README

StreamDeck API for Unix

This is a Go library for the streamdeckd daemon, not a standalone application. It provides interfaces for connecting to the daemon, accessing configuration objects, and creating custom handlers or GUI config editors for Elgato StreamDeck devices on Unix systems.

The library exposes an API for creating custom plugins to handle Stream Deck inputs (buttons, knobs, touch), managing icons and images, and also for communicating with the streamdeckd daemon via DBus.

Installation

go get github.com/unix-streamdeck/api

Usage

Connecting to the Stream Deck daemon
import (
    "fmt"
    "github.com/unix-streamdeck/api"
)

// Connect to the Stream Deck daemon
conn, err := api.Connect()
if err != nil {
    // Handle error
}
defer conn.Close()

// Get information about connected Stream Deck devices
devices, err := conn.GetInfo()
if err != nil {
    // Handle error
}

// Listen for page changes
err = conn.RegisterPageListener(func(serial string, page int32) {
    fmt.Printf("Device %s changed to page %d\n", serial, page)
})
Working with images
import (
    "github.com/unix-streamdeck/api"
    "image"
    _ "image/png"
    "os"
)

// Load an image
file, _ := os.Open("icon.png")
img, _, _ := image.Decode(file)

// Resize image to fit a Stream Deck key, ideally pass the `IconSize` field from `StreamDeckInfoV1` rather than magic num,ber
resizedImg := api.ResizeImage(img, 72) // 72x72 pixels

// Resize image with specific width and height (e.g., for LCD display) (`LcdWidth` and `LcdHeight` in `StreamDeckInfoV1`)
resizedLcdImg := api.ResizeImageWH(img, 800, 100)

// Add text to an image
imgWithText, _ := api.DrawText(resizedImg, "Hello", 0, "CENTER")
Implementing handlers
// Implement a handler
type MyHandler struct{
	running bool
}

func (h *MyHandler) Input(fields map[string]any, handlerType HandlerType, info StreamDeckInfoV1, event InputEvent) {
    switch event.EventType {
    case api.KNOB_CW:
        // Handle clockwise rotation
    case api.KNOB_CCW:
        // Handle counter-clockwise rotation
    case api.KNOB_PRESS:
        // Handle knob press
    case api.KEY_PRESS:
		// Handle key press
    }
}

func (h *MyHandler) Start(fields map[string]any, handlerType HandlerType, info StreamDeckInfoV1, callback func(image image.Image)) {
	// Generate image and send it back via callback
}

func (h *MyHandler) IsRunning() bool {
    return h.running
}

func (h *MyHandler) SetRunning(running bool) {
    h.running = running
}

func (h *MyHandler) Stop() {
    h.running = false
    // Clean up resources and stop calling callback
}

API Documentation

The API provides several interfaces for handling Stream Deck interactions:

  • Handler: Base interface for all handlers
  • ForegroundHandler: For handling dynamic icons/images
  • InputHandler: For handling input events
  • BackgroundHandler: For handling dynamic backgrounds for individual displays, or whole deck
  • CombinedHandler: For handlers that can do foregrounds and handle input, if this handler is applied to the foreground and input of a specific key/lcd segment, the same instance of the struct will be used, so resources can be shared

Key components:

  • Connection: Manages DBus communication with the Stream Deck daemon
  • Image utilities: Functions for drawing text and resizing images
  • Configuration management: Functions for getting and setting device configurations
Configuration Objects

The library exposes configuration objects that can be used to interact with the streamdeckd daemon:

// Get the current configuration
config, err := conn.GetConfig()
if err != nil {
    // Handle error
}

// Modify configuration
// ...

// Set the updated configuration
err = conn.SetConfig(config)
if err != nil {
    // Handle error
}


// Commit configuration changes to disk
err = conn.CommitConfig()

// Or Reload configuration from disk if the changes weren't correct
err = conn.ReloadConfig()

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Documentation

Index

Constants

View Source
const BorderClearance = 10

Variables

This section is empty.

Functions

func DrawProgressBar added in v2.0.11

func DrawProgressBar(img image.Image, label string, x, y, h, w, progress float64) (image.Image, error)

func DrawProgressBarWithAccent added in v2.0.11

func DrawProgressBarWithAccent(img image.Image, label string, x, y, h, w, progress float64, hex string) (image.Image, error)

func DrawText

func DrawText(img image.Image, text string, options DrawTextOptions) (image.Image, error)

func FindXDoToolKeybindString added in v2.0.4

func FindXDoToolKeybindString(code int) string

func HexColor added in v2.0.11

func HexColor(hex string) color.RGBA

func LayerImages added in v2.0.12

func LayerImages(x, y int, images ...image.Image) (image.Image, error)

func ParseXDoToolKeybindString added in v2.0.4

func ParseXDoToolKeybindString(keybind string) ([]int, error)

func ResizeImage

func ResizeImage(img image.Image, keySize int) image.Image

func ResizeImageWH

func ResizeImageWH(img image.Image, width int, height int) image.Image

func SubImage added in v2.0.14

func SubImage(img image.Image, x0, y0, x1, y1 int) image.Image

Types

type BackgroundHandler added in v2.0.15

type BackgroundHandler interface {
	ForegroundHandler
	StartGrid(fields map[string]any, handlerType HandlerType, info StreamDeckInfoV1, callback func(images []image.Image))
}

type CombinedHandler added in v2.0.16

type CombinedHandler interface {
	VisualHandler
	InputHandler
}

type ConfigV3

type ConfigV3 struct {
	Modules           []string            `json:"modules,omitempty"`
	Decks             []DeckV3            `json:"decks"`
	ObsConnectionInfo ObsConnectionInfoV2 `json:"obs_connection_info,omitempty"`
}

type Connection

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

func Connect

func Connect() (*Connection, error)

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) CommitConfig

func (c *Connection) CommitConfig() error

func (*Connection) GetConfig

func (c *Connection) GetConfig() (*ConfigV3, error)

func (*Connection) GetHandlerExample

func (c *Connection) GetHandlerExample(serial string, keyConfig KeyConfigV3) (image.Image, error)

func (*Connection) GetInfo

func (c *Connection) GetInfo() ([]*StreamDeckInfoV1, error)

func (*Connection) GetKnobHandlerExample added in v2.0.1

func (c *Connection) GetKnobHandlerExample(serial string, knobConfig KnobConfigV3) (image.Image, error)

func (*Connection) GetModules

func (c *Connection) GetModules() ([]*Module, error)

func (*Connection) GetObsFields

func (c *Connection) GetObsFields() ([]*Field, error)

func (*Connection) PressButton

func (c *Connection) PressButton(serial string, keyIndex int) error

func (*Connection) RegisterPageListener

func (c *Connection) RegisterPageListener(cback func(string, int32)) error

func (*Connection) ReloadConfig

func (c *Connection) ReloadConfig() error

func (*Connection) SetConfig

func (c *Connection) SetConfig(config *ConfigV3) error

func (*Connection) SetPage

func (c *Connection) SetPage(serial string, page int) error

type DeckV3

type DeckV3 struct {
	Serial                            string            `json:"serial"`
	Pages                             []PageV3          `json:"pages"`
	TouchPanelBackground              string            `json:"touch_panel_background"`
	TouchPanelBackgroundBuff          []image.Image     `json:"-"`
	TouchPanelBackgroundHandler       BackgroundHandler `json:"-"`
	TouchPanelBackgroundHandlerFields map[string]any    `json:"touch_panel_background_handler_fields"`
	KeyGridBackground                 string            `json:"key_grid_background"`
	KeyGridBackgroundBuff             []image.Image     `json:"-"`
	KeyGridBackgroundHandler          BackgroundHandler `json:"-"`
	KeyGridBackgroundHandlerFields    map[string]any    `json:"key_grid_background_handler_fields"`
}

func (*DeckV3) GetKeyGridBackground added in v2.0.14

func (d *DeckV3) GetKeyGridBackground() string

func (*DeckV3) GetKeyGridBackgroundBuff added in v2.0.14

func (d *DeckV3) GetKeyGridBackgroundBuff() []image.Image

func (*DeckV3) GetKeyGridBackgroundHandler added in v2.0.15

func (d *DeckV3) GetKeyGridBackgroundHandler() BackgroundHandler

func (*DeckV3) GetKeyGridBackgroundHandlerFields added in v2.0.15

func (d *DeckV3) GetKeyGridBackgroundHandlerFields() map[string]any

func (*DeckV3) GetTouchPanelBackground added in v2.0.13

func (d *DeckV3) GetTouchPanelBackground() string

func (*DeckV3) GetTouchPanelBackgroundBuff added in v2.0.13

func (d *DeckV3) GetTouchPanelBackgroundBuff() []image.Image

func (*DeckV3) GetTouchPanelBackgroundHandler added in v2.0.15

func (d *DeckV3) GetTouchPanelBackgroundHandler() BackgroundHandler

func (*DeckV3) GetTouchPanelBackgroundHandlerFields added in v2.0.15

func (d *DeckV3) GetTouchPanelBackgroundHandlerFields() map[string]any

func (*DeckV3) SetKeyGridBackgroundBuff added in v2.0.14

func (d *DeckV3) SetKeyGridBackgroundBuff(img []image.Image)

func (*DeckV3) SetKeyGridBackgroundHandler added in v2.0.15

func (d *DeckV3) SetKeyGridBackgroundHandler(handler BackgroundHandler)

func (*DeckV3) SetTouchPanelBackgroundBuff added in v2.0.13

func (d *DeckV3) SetTouchPanelBackgroundBuff(img []image.Image)

func (*DeckV3) SetTouchPanelBackgroundHandler added in v2.0.15

func (d *DeckV3) SetTouchPanelBackgroundHandler(handler BackgroundHandler)

type DrawTextOptions added in v2.0.10

type DrawTextOptions struct {
	FontSize          int64
	VerticalAlignment VerticalAlignment
	FontFace          string
	Colour            string
}

type Field

type Field struct {
	Title     string    `json:"title,omitempty"`
	Name      string    `json:"name,omitempty"`
	Type      FieldType `json:"type,omitempty"`
	FileTypes []string  `json:"file_types,omitempty"`
	ListItems []string  `json:"list_items,omitempty"`
}

type FieldType added in v2.0.10

type FieldType string
const (
	File          FieldType = "File"
	Text          FieldType = "Text"
	Number        FieldType = "Number"
	TextAlignment FieldType = "TextAlignment"
	FontFace      FieldType = "FontFace"
	Select        FieldType = "Select"
	Colour        FieldType = "Colour"
)

type ForegroundActions added in v2.0.16

type ForegroundActions interface {
	GetIcon() string
	GetText() string
	GetTextSize() int
	GetTextAlignment() VerticalAlignment
	GetFontFace() string
	GetTextColour() string
}

type ForegroundAndInputHandlerConfig added in v2.0.17

type ForegroundAndInputHandlerConfig interface {
	GetForegroundHandler() string
	GetForegroundHandlerInstance() ForegroundHandler
	SetForegroundHandlerInstance(handler ForegroundHandler)
	GetForegroundHandlerFields() map[string]any
	GetInputHandler() string
	GetInputHandlerInstance() InputHandler
	SetInputHandlerInstance(handler InputHandler)
	GetInputHandlerFields() map[string]any
	GetSharedHandlerFields() map[string]any
}

type ForegroundHandler added in v2.0.16

type ForegroundHandler interface {
	VisualHandler
	Start(fields map[string]any, handlerType HandlerType, info StreamDeckInfoV1, callback func(image image.Image))
}

type Handler

type Handler interface {
}

type HandlerType added in v2.0.16

type HandlerType uint8
const (
	LCD HandlerType = iota
	KEY
)

type IConn

type IConn interface {
	Close() error
	AddMatchSignal(options ...dbus.MatchOption) error
	Signal(ch chan<- *dbus.Signal)
	Object(dest string, path dbus.ObjectPath) dbus.BusObject
}

type IContext added in v2.0.10

type IContext interface {
	SetRGB(r, g, b float64)
	SetHexColor(color string)
	SetFontFace(font font.Face)
	WordWrap(text string, width float64) []string
	DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align gg.Align)
	Image() image.Image
	MeasureMultilineString(text string, lineSpacing float64) (float64, float64)
	Width() int
	Height() int
}

type InputActions added in v2.0.16

type InputActions interface {
	GetSwitchPage() int
	GetKeyBind() string
	GetCommand() string
	GetBrightness() int
	GetUrl() string
	GetObsCommand() string
	GetObsCommandParams() map[string]string
}

type InputEvent

type InputEvent struct {
	EventType     InputEventType
	RotateNotches uint8
}

type InputEventType

type InputEventType uint8
const (
	KNOB_CCW InputEventType = iota
	KNOB_CW
	KNOB_PRESS
	SCREEN_SHORT_TAP
	SCREEN_LONG_TAP
	SCREEN_SWIPE
	KEY_PRESS
	KEY_RELEASE
)

type InputHandler added in v2.0.15

type InputHandler interface {
	Handler
	Input(fields map[string]any, handlerType HandlerType, info StreamDeckInfoV1, event InputEvent)
}

type KeyBackgrounder added in v2.0.15

type KeyBackgrounder interface {
	GetKeyBackground() string
	GetKeyBackgroundBuff() image.Image
	SetKeyBackgroundBuff(img image.Image)
	GetKeyBackgroundHandler() BackgroundHandler
	SetKeyBackgroundHandler(handler BackgroundHandler)
	GetKeyBackgroundHandlerFields() map[string]any
}

type KeyConfigV3

type KeyConfigV3 struct {
	Icon                       string            `json:"icon,omitempty"`
	Text                       string            `json:"text,omitempty"`
	TextSize                   int               `json:"text_size,omitempty"`
	TextAlignment              VerticalAlignment `json:"text_alignment,omitempty"`
	FontFace                   string            `json:"font_face,omitempty"`
	TextColour                 string            `json:"text_colour,omitempty"`
	SwitchPage                 int               `json:"switch_page,omitempty"`
	Keybind                    string            `json:"keybind,omitempty"`
	Command                    string            `json:"command,omitempty"`
	Brightness                 int               `json:"brightness,omitempty"`
	Url                        string            `json:"url,omitempty"`
	KeyHold                    int               `json:"key_hold,omitempty"`
	ObsCommand                 string            `json:"obs_command,omitempty"`
	ObsCommandParams           map[string]string `json:"obs_command_params,omitempty"`
	IconHandler                string            `json:"icon_handler,omitempty"`
	KeyHandler                 string            `json:"key_handler,omitempty"`
	IconHandlerFields          map[string]any    `json:"icon_handler_fields,omitempty"`
	KeyHandlerFields           map[string]any    `json:"key_handler_fields,omitempty"`
	SharedHandlerFields        map[string]any    `json:"shared_handler_fields,omitempty"`
	IconHandlerStruct          ForegroundHandler `json:"-"`
	KeyHandlerStruct           InputHandler      `json:"-"`
	KeyBackground              string            `json:"background"`
	KeyBackgroundBuff          image.Image       `json:"-"`
	KeyBackgroundHandler       BackgroundHandler `json:"-"`
	KeyBackgroundHandlerFields map[string]any    `json:"key_background_handler_fields"`
}

func (*KeyConfigV3) GetBrightness added in v2.0.16

func (kc *KeyConfigV3) GetBrightness() int

func (*KeyConfigV3) GetCommand added in v2.0.16

func (kc *KeyConfigV3) GetCommand() string

func (*KeyConfigV3) GetFontFace added in v2.0.16

func (kc *KeyConfigV3) GetFontFace() string

func (*KeyConfigV3) GetForegroundHandler added in v2.0.17

func (kc *KeyConfigV3) GetForegroundHandler() string

func (*KeyConfigV3) GetForegroundHandlerFields added in v2.0.17

func (kc *KeyConfigV3) GetForegroundHandlerFields() map[string]any

func (*KeyConfigV3) GetForegroundHandlerInstance added in v2.0.17

func (kc *KeyConfigV3) GetForegroundHandlerInstance() ForegroundHandler

func (*KeyConfigV3) GetIcon added in v2.0.16

func (kc *KeyConfigV3) GetIcon() string

func (*KeyConfigV3) GetInputHandler added in v2.0.17

func (kc *KeyConfigV3) GetInputHandler() string

func (*KeyConfigV3) GetInputHandlerFields added in v2.0.17

func (kc *KeyConfigV3) GetInputHandlerFields() map[string]any

func (*KeyConfigV3) GetInputHandlerInstance added in v2.0.17

func (kc *KeyConfigV3) GetInputHandlerInstance() InputHandler

func (*KeyConfigV3) GetKeyBackground added in v2.0.15

func (kc *KeyConfigV3) GetKeyBackground() string

func (*KeyConfigV3) GetKeyBackgroundBuff added in v2.0.15

func (kc *KeyConfigV3) GetKeyBackgroundBuff() image.Image

func (*KeyConfigV3) GetKeyBackgroundHandler added in v2.0.15

func (kc *KeyConfigV3) GetKeyBackgroundHandler() BackgroundHandler

func (*KeyConfigV3) GetKeyBackgroundHandlerFields added in v2.0.15

func (kc *KeyConfigV3) GetKeyBackgroundHandlerFields() map[string]any

func (*KeyConfigV3) GetKeyBind added in v2.0.16

func (kc *KeyConfigV3) GetKeyBind() string

func (*KeyConfigV3) GetObsCommand added in v2.0.16

func (kc *KeyConfigV3) GetObsCommand() string

func (*KeyConfigV3) GetObsCommandParams added in v2.0.16

func (kc *KeyConfigV3) GetObsCommandParams() map[string]string

func (*KeyConfigV3) GetSharedHandlerFields added in v2.0.17

func (kc *KeyConfigV3) GetSharedHandlerFields() map[string]any

func (*KeyConfigV3) GetSwitchPage added in v2.0.16

func (kc *KeyConfigV3) GetSwitchPage() int

func (*KeyConfigV3) GetText added in v2.0.16

func (kc *KeyConfigV3) GetText() string

func (*KeyConfigV3) GetTextAlignment added in v2.0.16

func (kc *KeyConfigV3) GetTextAlignment() VerticalAlignment

func (*KeyConfigV3) GetTextColour added in v2.0.16

func (kc *KeyConfigV3) GetTextColour() string

func (*KeyConfigV3) GetTextSize added in v2.0.16

func (kc *KeyConfigV3) GetTextSize() int

func (*KeyConfigV3) GetUrl added in v2.0.16

func (kc *KeyConfigV3) GetUrl() string

func (*KeyConfigV3) SetForegroundHandlerInstance added in v2.0.17

func (kc *KeyConfigV3) SetForegroundHandlerInstance(handler ForegroundHandler)

func (*KeyConfigV3) SetInputHandlerInstance added in v2.0.17

func (kc *KeyConfigV3) SetInputHandlerInstance(handler InputHandler)

func (*KeyConfigV3) SetKeyBackgroundBuff added in v2.0.15

func (kc *KeyConfigV3) SetKeyBackgroundBuff(img image.Image)

func (*KeyConfigV3) SetKeyBackgroundHandler added in v2.0.15

func (kc *KeyConfigV3) SetKeyBackgroundHandler(handler BackgroundHandler)

type KeyGridBackgrounder added in v2.0.14

type KeyGridBackgrounder interface {
	GetKeyGridBackground() string
	GetKeyGridBackgroundBuff() []image.Image
	SetKeyGridBackgroundBuff(img []image.Image)
	GetKeyGridBackgroundHandler() BackgroundHandler
	SetKeyGridBackgroundHandler(handler BackgroundHandler)
	GetKeyGridBackgroundHandlerFields() map[string]any
}

type KeyV3

type KeyV3 struct {
	Application                map[string]*KeyConfigV3 `json:"application,omitempty"`
	ActiveBuff                 image.Image             `json:"-"`
	ActiveIconHandlerStruct    *ForegroundHandler      `json:"-"`
	ActiveKeyHandlerStruct     *InputHandler           `json:"-"`
	ActiveApplication          string                  `json:"-"`
	KeyBackground              string                  `json:"background"`
	KeyBackgroundBuff          image.Image             `json:"-"`
	KeyBackgroundHandler       BackgroundHandler       `json:"-"`
	KeyBackgroundHandlerFields map[string]any          `json:"key_background_handler_fields"`
}

func (*KeyV3) GetKeyBackground added in v2.0.15

func (k *KeyV3) GetKeyBackground() string

func (*KeyV3) GetKeyBackgroundBuff added in v2.0.15

func (k *KeyV3) GetKeyBackgroundBuff() image.Image

func (*KeyV3) GetKeyBackgroundHandler added in v2.0.15

func (k *KeyV3) GetKeyBackgroundHandler() BackgroundHandler

func (*KeyV3) GetKeyBackgroundHandlerFields added in v2.0.15

func (k *KeyV3) GetKeyBackgroundHandlerFields() map[string]any

func (*KeyV3) SetKeyBackgroundBuff added in v2.0.15

func (k *KeyV3) SetKeyBackgroundBuff(img image.Image)

func (*KeyV3) SetKeyBackgroundHandler added in v2.0.15

func (k *KeyV3) SetKeyBackgroundHandler(handler BackgroundHandler)

type KnobActionV3

type KnobActionV3 struct {
	SwitchPage       int               `json:"switch_page,omitempty"`
	Keybind          string            `json:"keybind,omitempty"`
	Command          string            `json:"command,omitempty"`
	Brightness       int               `json:"brightness,omitempty"`
	Url              string            `json:"url,omitempty"`
	ObsCommand       string            `json:"obs_command,omitempty"`
	ObsCommandParams map[string]string `json:"obs_command_params,omitempty"`
}

func (*KnobActionV3) GetBrightness added in v2.0.16

func (k *KnobActionV3) GetBrightness() int

func (*KnobActionV3) GetCommand added in v2.0.16

func (k *KnobActionV3) GetCommand() string

func (*KnobActionV3) GetKeyBind added in v2.0.16

func (k *KnobActionV3) GetKeyBind() string

func (*KnobActionV3) GetObsCommand added in v2.0.16

func (k *KnobActionV3) GetObsCommand() string

func (*KnobActionV3) GetObsCommandParams added in v2.0.16

func (k *KnobActionV3) GetObsCommandParams() map[string]string

func (*KnobActionV3) GetSwitchPage added in v2.0.16

func (k *KnobActionV3) GetSwitchPage() int

func (*KnobActionV3) GetUrl added in v2.0.16

func (k *KnobActionV3) GetUrl() string

type KnobConfigV3

type KnobConfigV3 struct {
	Icon                              string            `json:"icon,omitempty"`
	Text                              string            `json:"text,omitempty"`
	TextSize                          int               `json:"text_size,omitempty"`
	TextAlignment                     VerticalAlignment `json:"text_alignment,omitempty"`
	FontFace                          string            `json:"font_face,omitempty"`
	TextColour                        string            `json:"text_colour,omitempty"`
	LcdHandler                        string            `json:"lcd_handler,omitempty"`
	KnobOrTouchHandler                string            `json:"knob_or_touch_handler,omitempty"`
	LcdHandlerStruct                  ForegroundHandler `json:"-"`
	KnobOrTouchHandlerStruct          InputHandler      `json:"-"`
	LcdHandlerFields                  map[string]any    `json:"lcd_handler_fields,omitempty"`
	KnobOrTouchHandlerFields          map[string]any    `json:"knob_or_touch_handler_fields,omitempty"`
	SharedHandlerFields               map[string]any    `json:"shared_handler_fields,omitempty"`
	KnobPressAction                   KnobActionV3      `json:"knob_press_action,omitempty"`
	KnobTurnUpAction                  KnobActionV3      `json:"knob_turn_up_action,omitempty"`
	KnobTurnDownAction                KnobActionV3      `json:"knob_turn_down_action,omitempty"`
	TouchPanelBackground              string            `json:"touch_panel_background"`
	TouchPanelBackgroundBuff          image.Image       `json:"-"`
	TouchPanelBackgroundHandler       ForegroundHandler `json:"-"`
	TouchPanelBackgroundHandlerFields map[string]any    `json:"touch_panel_background_handler_fields"`
}

func (*KnobConfigV3) GetFontFace added in v2.0.16

func (kc *KnobConfigV3) GetFontFace() string

func (*KnobConfigV3) GetForegroundHandler added in v2.0.17

func (kc *KnobConfigV3) GetForegroundHandler() string

func (*KnobConfigV3) GetForegroundHandlerFields added in v2.0.17

func (kc *KnobConfigV3) GetForegroundHandlerFields() map[string]any

func (*KnobConfigV3) GetForegroundHandlerInstance added in v2.0.17

func (kc *KnobConfigV3) GetForegroundHandlerInstance() ForegroundHandler

func (*KnobConfigV3) GetIcon added in v2.0.16

func (kc *KnobConfigV3) GetIcon() string

func (*KnobConfigV3) GetInputHandler added in v2.0.17

func (kc *KnobConfigV3) GetInputHandler() string

func (*KnobConfigV3) GetInputHandlerFields added in v2.0.17

func (kc *KnobConfigV3) GetInputHandlerFields() map[string]any

func (*KnobConfigV3) GetInputHandlerInstance added in v2.0.17

func (kc *KnobConfigV3) GetInputHandlerInstance() InputHandler

func (*KnobConfigV3) GetSharedHandlerFields added in v2.0.17

func (kc *KnobConfigV3) GetSharedHandlerFields() map[string]any

func (*KnobConfigV3) GetText added in v2.0.16

func (kc *KnobConfigV3) GetText() string

func (*KnobConfigV3) GetTextAlignment added in v2.0.16

func (kc *KnobConfigV3) GetTextAlignment() VerticalAlignment

func (*KnobConfigV3) GetTextColour added in v2.0.16

func (kc *KnobConfigV3) GetTextColour() string

func (*KnobConfigV3) GetTextSize added in v2.0.16

func (kc *KnobConfigV3) GetTextSize() int

func (*KnobConfigV3) GetTouchPanelBackground added in v2.0.13

func (kc *KnobConfigV3) GetTouchPanelBackground() string

func (*KnobConfigV3) GetTouchPanelBackgroundBuff added in v2.0.13

func (kc *KnobConfigV3) GetTouchPanelBackgroundBuff() image.Image

func (*KnobConfigV3) GetTouchPanelBackgroundHandler added in v2.0.15

func (kc *KnobConfigV3) GetTouchPanelBackgroundHandler() ForegroundHandler

func (*KnobConfigV3) GetTouchPanelBackgroundHandlerFields added in v2.0.15

func (kc *KnobConfigV3) GetTouchPanelBackgroundHandlerFields() map[string]any

func (*KnobConfigV3) SetForegroundHandlerInstance added in v2.0.17

func (kc *KnobConfigV3) SetForegroundHandlerInstance(handler ForegroundHandler)

func (*KnobConfigV3) SetInputHandlerInstance added in v2.0.17

func (kc *KnobConfigV3) SetInputHandlerInstance(handler InputHandler)

func (*KnobConfigV3) SetTouchPanelBackgroundBuff added in v2.0.13

func (kc *KnobConfigV3) SetTouchPanelBackgroundBuff(img image.Image)

func (*KnobConfigV3) SetTouchPanelBackgroundHandler added in v2.0.15

func (kc *KnobConfigV3) SetTouchPanelBackgroundHandler(handler ForegroundHandler)

type KnobV3

type KnobV3 struct {
	Application                       map[string]*KnobConfigV3 `json:"application,omitempty"`
	ActiveBuff                        image.Image              `json:"-"`
	ActiveApplication                 string                   `json:"-"`
	TouchPanelBackground              string                   `json:"touch_panel_background"`
	TouchPanelBackgroundBuff          image.Image              `json:"-"`
	TouchPanelBackgroundHandler       ForegroundHandler        `json:"-"`
	TouchPanelBackgroundHandlerFields map[string]any           `json:"touch_panel_background_handler_fields"`
}

func (*KnobV3) GetTouchPanelBackground added in v2.0.13

func (k *KnobV3) GetTouchPanelBackground() string

func (*KnobV3) GetTouchPanelBackgroundBuff added in v2.0.13

func (k *KnobV3) GetTouchPanelBackgroundBuff() image.Image

func (*KnobV3) GetTouchPanelBackgroundHandler added in v2.0.15

func (k *KnobV3) GetTouchPanelBackgroundHandler() ForegroundHandler

func (*KnobV3) GetTouchPanelBackgroundHandlerFields added in v2.0.15

func (k *KnobV3) GetTouchPanelBackgroundHandlerFields() map[string]any

func (*KnobV3) SetTouchPanelBackgroundBuff added in v2.0.13

func (k *KnobV3) SetTouchPanelBackgroundBuff(img image.Image)

func (*KnobV3) SetTouchPanelBackgroundHandler added in v2.0.15

func (k *KnobV3) SetTouchPanelBackgroundHandler(handler ForegroundHandler)

type LcdBackgrounder added in v2.0.14

type LcdBackgrounder interface {
	GetTouchPanelBackground() string
	GetTouchPanelBackgroundBuff() []image.Image
	SetTouchPanelBackgroundBuff(img []image.Image)
	GetTouchPanelBackgroundHandler() BackgroundHandler
	SetTouchPanelBackgroundHandler(handler BackgroundHandler)
	GetTouchPanelBackgroundHandlerFields() map[string]any
}

type LcdSegmentBackgrounder added in v2.0.15

type LcdSegmentBackgrounder interface {
	GetTouchPanelBackground() string
	GetTouchPanelBackgroundBuff() image.Image
	SetTouchPanelBackgroundBuff(img image.Image)
	GetTouchPanelBackgroundHandler() ForegroundHandler
	SetTouchPanelBackgroundHandler(handler ForegroundHandler)
	GetTouchPanelBackgroundHandlerFields() map[string]any
}

type Module

type Module struct {
	Name string `json:"name,omitempty"`

	NewForeground func() ForegroundHandler `json:"-"`
	NewInput      func() InputHandler      `json:"-"`
	NewBackground func() BackgroundHandler `json:"-"`

	ForegroundFields []Field `json:"icon_fields,omitempty"`
	InputFields      []Field `json:"key_fields,omitempty"`
	BackgroundFields []Field `json:"lcd_fields,omitempty"`
	LinkedFields     []Field `json:"linked_fields,omitempty"`

	IsForeground     bool `json:"is_foreground,omitempty"`
	IsInput          bool `json:"is_input,omitempty"`
	IsBackground     bool `json:"is_background,omitempty"`
	IsLinkedHandlers bool `json:"is_linked_handlers,omitempty"`
	Linked           bool `json:"linked,omitempty"`
}

type ObsConnectionInfoV2

type ObsConnectionInfoV2 struct {
	Host string `json:"host,omitempty"`
	Port int    `json:"port,omitempty"`
}

type PageV3

type PageV3 struct {
	Keys                              []KeyV3           `json:"keys"`
	Knobs                             []KnobV3          `json:"knobs"`
	TouchPanelBackground              string            `json:"touch_panel_background"`
	TouchPanelBackgroundBuff          []image.Image     `json:"-"`
	TouchPanelBackgroundHandler       BackgroundHandler `json:"-"`
	TouchPanelBackgroundHandlerFields map[string]any    `json:"touch_panel_background_handler_fields"`
	KeyGridBackground                 string            `json:"key_grid_background"`
	KeyGridBackgroundBuff             []image.Image     `json:"-"`
	KeyGridBackgroundHandler          BackgroundHandler `json:"-"`
	KeyGridBackgroundHandlerFields    map[string]any    `json:"key_grid_background_handler_fields"`
}

func (*PageV3) GetKeyGridBackground added in v2.0.14

func (p *PageV3) GetKeyGridBackground() string

func (*PageV3) GetKeyGridBackgroundBuff added in v2.0.14

func (p *PageV3) GetKeyGridBackgroundBuff() []image.Image

func (*PageV3) GetKeyGridBackgroundHandler added in v2.0.15

func (p *PageV3) GetKeyGridBackgroundHandler() BackgroundHandler

func (*PageV3) GetKeyGridBackgroundHandlerFields added in v2.0.15

func (p *PageV3) GetKeyGridBackgroundHandlerFields() map[string]any

func (*PageV3) GetTouchPanelBackground added in v2.0.13

func (p *PageV3) GetTouchPanelBackground() string

func (*PageV3) GetTouchPanelBackgroundBuff added in v2.0.13

func (p *PageV3) GetTouchPanelBackgroundBuff() []image.Image

func (*PageV3) GetTouchPanelBackgroundHandler added in v2.0.15

func (p *PageV3) GetTouchPanelBackgroundHandler() BackgroundHandler

func (*PageV3) GetTouchPanelBackgroundHandlerFields added in v2.0.15

func (p *PageV3) GetTouchPanelBackgroundHandlerFields() map[string]any

func (*PageV3) SetKeyGridBackgroundBuff added in v2.0.14

func (p *PageV3) SetKeyGridBackgroundBuff(img []image.Image)

func (*PageV3) SetKeyGridBackgroundHandler added in v2.0.15

func (p *PageV3) SetKeyGridBackgroundHandler(handler BackgroundHandler)

func (*PageV3) SetTouchPanelBackgroundBuff added in v2.0.13

func (p *PageV3) SetTouchPanelBackgroundBuff(img []image.Image)

func (*PageV3) SetTouchPanelBackgroundHandler added in v2.0.15

func (p *PageV3) SetTouchPanelBackgroundHandler(handler BackgroundHandler)

type StreamDeckInfoV1

type StreamDeckInfoV1 struct {
	Cols                    int       `json:"cols,omitempty"`
	Rows                    int       `json:"rows,omitempty"`
	IconSize                int       `json:"icon_size,omitempty"`
	Page                    int       `json:"page"`
	Serial                  string    `json:"serial,omitempty"`
	Name                    string    `json:"name,omitempty"`
	Connected               bool      `json:"connected"`
	LastConnected           time.Time `json:"last_connected,omitempty"`
	LastDisconnected        time.Time `json:"last_disconnected,omitempty"`
	LcdWidth                int       `json:"lcd_width,omitempty"`
	LcdHeight               int       `json:"lcd_height,omitempty"`
	LcdCols                 int       `json:"lcd_cols,omitempty"`
	KnobCols                int       `json:"knob_cols,omitempty"`
	PaddingX                int       `json:"padding_x"`
	PaddingY                int       `json:"padding_y"`
	KeyGridBackgroundWidth  int       `json:"key_grid_background_width"`
	KeyGridBackgroundHeight int       `json:"key_grid_background_height"`
	LcdBackgroundWidth      int       `json:"lcd_background_width"`
	LcdBackgroundHeight     int       `json:"lcd_background_height"`
}

func (StreamDeckInfoV1) GetDimensions added in v2.0.16

func (info StreamDeckInfoV1) GetDimensions(handlerType HandlerType) (int, int)

func (StreamDeckInfoV1) GetGridDimensions added in v2.0.16

func (info StreamDeckInfoV1) GetGridDimensions(handlerType HandlerType) (int, int)

func (StreamDeckInfoV1) SplitBackgroundImage added in v2.0.16

func (info StreamDeckInfoV1) SplitBackgroundImage(background image.Image, handlerType HandlerType) []image.Image

type VerticalAlignment added in v2.0.10

type VerticalAlignment string

TODO replace use of gg with native font.Drawer

const (
	Top    VerticalAlignment = "TOP"
	Center VerticalAlignment = "CENTER"
	Bottom VerticalAlignment = "BOTTOM"
)

type VisualHandler added in v2.0.15

type VisualHandler interface {
	Handler
	IsRunning() bool
	SetRunning(running bool)
	Stop()
}

Directories

Path Synopsis
mocks
mock_api
Package mock_api is a generated GoMock package.
Package mock_api is a generated GoMock package.
mock_dbus
Package mock_dbus is a generated GoMock package.
Package mock_dbus is a generated GoMock package.

Jump to

Keyboard shortcuts

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