hammerspoon2-docs
    Preparing search index...

    Class HSStreamDeckDevice

    A Stream Deck device, obtained via hs.streamdeck.all() or a discovery watcher — do not instantiate directly.

    Index

    Constructors

    Properties

    deckType: string

    A human-readable description of the device model (e.g. "Elgato Stream Deck (XL)").

    encoderColumns: number

    The number of rotary encoders (Stream Deck Plus only; 0 on other models).

    encoderCount: number

    The total number of encoders (encoderColumns * encoderRows).

    encoderRows: number

    The number of encoder rows (Stream Deck Plus only; 0 on other models).

    firmwareVersion: string

    The device's firmware version. Reads live from the hardware on every access.

    identifier: string

    The unique identifier assigned to this device object.

    imageSize: HSSize

    The pixel dimensions required for button images.

    keyColumns: number

    The number of button columns.

    keyCount: number

    The total number of buttons (keyColumns * keyRows).

    keyRows: number

    The number of button rows.

    serialNumber: string

    The device's serial number.

    Methods

    • Sets the callback for button press/release events. Replaces any previously set callback. The callback receives: this device, the button number, and whether it is now pressed.

      Parameters

      • fn: (device: HSStreamDeckDevice, button: number, isDown: boolean) => void

        The function to call on button events

      Returns HSStreamDeckDevice

      self, for chaining

    • Stops delivering events and releases all callbacks. Called automatically when the device is disconnected or the module shuts down.

      Returns void

    • Sets the callback for encoder press/release/rotation events (Stream Deck Plus only). Replaces any previously set callback. The callback receives: this device, the encoder number, whether it is now pressed, and two booleans indicating rotation direction (at most one is true per call).

      Parameters

      • fn: (
            device: HSStreamDeckDevice,
            encoder: number,
            isDown: boolean,
            turningLeft: boolean,
            turningRight: boolean,
        ) => void

        The function to call on encoder events

      Returns HSStreamDeckDevice

      self, for chaining

    • Sets the callback for LCD touch-screen events (Stream Deck Plus only). Replaces any previously set callback. The callback receives: this device, the event type ("shortPress", "longPress", or "swipe"), and the start/end X/Y coordinates (end coordinates are 0 unless swiping).

      Parameters

      • fn: (
            device: HSStreamDeckDevice,
            eventType: string,
            startX: number,
            startY: number,
            endX: number,
            endY: number,
        ) => void

        The function to call on screen events

      Returns HSStreamDeckDevice

      self, for chaining

    • Sets the device's brightness.

      Parameters

      • brightness: number

        A whole number 0-100, the percentage brightness level

      Returns HSStreamDeckDevice

      self, for chaining

    • Sets a button's image.

      Parameters

      • button: number

        The button number, from 1 to keyCount

      • image: HSImage

        An HSImage to display on the button. It is resized to fit.

      Returns HSStreamDeckDevice

      self, for chaining

    • Sets the LCD strip image above one encoder (Stream Deck Plus only; a no-op on other models).

      Parameters

      • encoder: number

        The encoder number, from 1 to encoderColumns

      • image: HSImage

        An HSImage to display. It is resized to fit.

      Returns HSStreamDeckDevice

      self, for chaining