Space Plugin SDKSpace Plugin SDK
Home
Overview
  • 中文简体
  • English
Home
Overview
  • 中文简体
  • English
  • SDK

    • Overview
    • Getting Started
    • Terminology
    • Architecture
    • Manifest
    • Internationalization
    • Received Events
    • Events Sent
    • Registration Procedure
    • Property Inspector
    • Style Guide
    • Changelog
  • Example

    • Counter
    • Timer
    • Number Display
    • Time
  • Support

    • Help and Error Reporting

Received Events

Plugins can receive events from the Stream Dock application.

Once the Stream Dock application has loaded a plugin and the user has set up some keys to use the plugin, the plugin will receive various events. Similarly, when the Property Inspector is displayed, it will receive some events.

Both plugins and Property Inspectors can receive the following events:

EventDescription
didReceiveSettingsEvent received after settings change
didReceiveGlobalSettingsEvent received after globalSettings change

Plugins may also receive the following additional events:

EventDescription
keyDownEvent received when a user presses a key
keyUpEvent received when a user releases a key
dialDownEvent received when a user presses a dial
dialUpEvent received when a user releases a pressed dial
dialRotateEvent received when a user rotates a dial
willAppearEvent received when an action instance appears on the Stream Dock (e.g., when hardware is first inserted or when entering a folder containing the action)
willDisappearEvent received when an action instance no longer appears on the Stream Dock (e.g., when switching profiles or folders)
titleParametersDidChangeEvent received when the user changes the title or title parameters
deviceDidConnectEvent received when a device is inserted into the computer
deviceDidDisconnectEvent received when a device is removed from the computer
applicationDidLaunchEvent received when a monitored application is launched
applicationDidTerminateEvent received when a monitored application terminates
systemDidWakeUpEvent received when the computer wakes up
propertyInspectorDidAppearEvent received when the Property Inspector appears in the Stream Dock UI (e.g., when selecting a new instance)
propertyInspectorDidDisappearEvent received when the Property Inspector is destroyed in the Stream Dock UI (e.g., when selecting a new instance and the old instance triggers this event)
sendToPluginEvent received when the Property Inspector uses this event

Property Inspectors may also receive the following event:

EventDescription
sendToPropertyInspectorEvent received when the plugin uses this event

didReceiveSettings

Event received after settings change

{
  "action": "com.mirabox.demo.action1", 
  "event": "didReceiveSettings", 
  "context": "uniqueValue", 
  "device": "uniqueValue", 
  "payload": {
   "settings": {<json data>},
    "coordinates": {
      "column": 3, 
      "row": 1
    }, 
    "isInMultiAction": false
  }
}
MemberDescription
actionUnique identifier for the action
eventdidReceiveSettings
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
stateSet only if the action defines multiple states in its manifest.json. The value, starting from 0, contains the current state of the action
isInMultiActionBoolean indicating whether the action is within a Multi-Action

didReceiveGlobalSettings

Event received after globalSettings change

{
  "event": "didReceiveGlobalSettings", 
  "payload": {
   "settings": {<json data>}
  }
}
MemberDescription
eventdidReceiveGlobalSettings
payloadA JSON object

The payload object contains the following member:

PayloadDescription
settingsThis JSON object contains the persistent storage data

dialDown

When the user presses the knob, the plugin will receive the event

{
  "action": "com.mirabox.demo.action2",
  "event": "dialDown",
  "context": uniqueValue,
  "device": uniqueValue,
  "payload": {
    "controller": "Encoder",
    "settings": {<json data>},
    "coordinates": {
      "column": 0,
      "row": 0
    },
  }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventdialDown
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
controllerEncoder

dialUp

When the user releases the pressed knob, the plugin will receive the event

{
  "action": "com.mirabox.demo.action2",
  "event": "dialUp",
  "context": uniqueValue,
  "device": uniqueValue,
  "payload": {
    "controller": "Encoder",
    "settings": {<json data>},
    "coordinates": {
      "column": 0,
      "row": 0
    },
  }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventdialUp
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
controllerEncoder

dialRotate

When the user presses a key, the plugin will receive the event

{
  "action": "com.mirabox.demo.action2",
  "event": "dialRotate",
  "context": uniqueValue,
  "device": uniqueValue,
  "payload": {
    "controller": "Encoder",
    "settings": {<json data>},
    "coordinates": {
      "column": 0,
      "row": 0
    },
    "ticks": -5,
    "pressed": false
  }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventdialRotate
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
controllerEncoder
ticksAn integer representing the number of "ticks" during knob rotation. Positive values indicate clockwise rotation, negative values indicate counterclockwise rotation, and zero indicates no rotation
pressedBoolean value indicating whether the knob was in a pressed state during rotation

keyDown

When the user presses a key, the plugin will receive the event

{
  "action": "com.mirabox.demo.action2",
  "event": "keyDown",
  "context": uniqueValue,
  "device": uniqueValue,
  "payload": {
    "settings": {<json data>},
    "coordinates": {
      "column": 0,
      "row": 0
    },
    "state": 0,
    "isInMultiAction": false
  }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventkeyDown
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
stateSet only if the action has multiple states defined in its manifest.json. The value starting from 0 represents the current state of the action
isInMultiActionBoolean value indicating whether the action is within a Multi-Action

keyUp

When the user releases a key, the plugin will receive the event

{
  "action": "com.mirabox.demo.action2",
  "event": "keyUp",
  "context": uniqueValue,
  "device": uniqueValue,
  "payload": {
    "settings": {<json data>},
    "coordinates": {
      "column": 0,
      "row": 0
    },
    "state": 0,
    "isInMultiAction": false
  }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventkeyUp
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
stateSet only if the action has multiple states defined in its manifest.json. The value starting from 0 represents the current state of the action
isInMultiActionBoolean value indicating whether the action is within a Multi-Action

willAppear

When an instance of an action appears on the Stream Dock, such as when hardware is first inserted or when entering a folder that contains the action, the plugin will receive an event. You will see this event in the following scenarios:

  • The Stream Dock application starts

  • The user switches between profiles

  • The user sets a key to use your action

{
    "action": "com.mirabox.demo.action1",
    "event": "willAppear",
    "context": uniqueValue,
    "device": uniqueValue,
    "payload": {
        "settings": {<json data>},
        "coordinates": {
            "column": 3, 
            "row": 1
        },
        "controller": "Keypad",
        "state": 0,
        "isInMultiAction": false
    }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventwillAppear
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
controllerKeypad (normal buttons), Information (view-only, no touch or button events), SecondaryScreen (small screen display), Knob (rotary control)
stateSet only if the action has multiple states defined in its manifest.json. The value starting from 0 represents the current state of the action
isInMultiActionBoolean value indicating whether the action is within a Multi-Action

willDisappear

When an instance of an action stops being displayed on the Stream Dock, such as when switching profiles or folders, the plugin will receive an event. You will see this event in the following scenarios:

  • The user switches between profiles

  • The user deletes the action

{
    "action": "com.mirabox.demo.action1",
    "event": "willDisappear",
    "context": uniqueValue,
    "device": uniqueValue,
    "payload": {
        "settings": {<json data>},
        "coordinates": {
            "column": 3, 
            "row": 1
        },
        "controller": "Keypad",
        "state": 0,
        "isInMultiAction": false
    }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventwillDisappear
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
controllerKeypad (normal buttons), Information (view-only, no touch or button events), SecondaryScreen (small screen display), Knob (rotary control)
stateSet only if the action has multiple states defined in its manifest.json. The value starting from 0 represents the current state of the action
isInMultiActionBoolean value indicating whether the action is within a Multi-Action

titleParametersDidChange

When the user changes the title or title parameters of an action instance, the plugin will receive this event

{
  "action": "com.mirabox.demo.action1", 
  "event": "titleParametersDidChange", 
  "context": "uniqueValue", 
  "device": "uniqueValue", 
  "payload": {
    "coordinates": {
      "column": 3, 
      "row": 1
    }, 
    "settings": {<json data>}, 
    "state": 0, 
    "title": "", 
    "titleParameters": {
      "fontFamily": "", 
      "fontSize": 12, 
      "fontStyle": "", 
      "fontUnderline": false, 
      "showTitle": true, 
      "titleAlignment": "bottom", 
      "titleColor": "#ffffff"
    }
  }
}
MemberDescription
actionUnique identifier for the action. If your plugin supports multiple actions, use this value to determine which action was triggered
eventtitleParametersDidChange
contextValue that identifies the instance action
deviceValue used to identify the device
payloadA JSON object

The payload object contains the following members:

PayloadDescription
settingsThis JSON object contains the persistent storage data
coordinatesCoordinates of the triggered action
titleNew title
stateSet only if the action has multiple states defined in its manifest.json. The value starting from 0 represents the current state of the action
titleParametersJSON object describing the new title parameters

The titleParameters object contains the following members:

TitleParametersDescription
fontFamilyTitle font
fontSizeFont size of the title
fontStyleFont style of the title
fontUnderlineBoolean value for the title underline
showTitleBoolean value indicating whether the title is visible
titleAlignmentPosition of the title
titleColorTitle color

deviceDidConnect

When a device is inserted into the computer, the plugin will receive this event

{
 "event": "deviceDidConnect",
    "device": uniqueValue,
     "deviceInfo": {
        "name": "Device Name",
        "type": 0,
         "size": {
            "columns": 5,
            "rows": 3
        }
    },
}
MemberDescription
eventdeviceDidConnect
deviceValue used to identify the device
deviceInfoA JSON object

The deviceInfo object contains the following members:

DeviceDescription
typeType of the device
sizeNumber of rows and columns of keys the device has
nameName of the device

deviceDidDisconnect

When a device is disconnected from the computer, the plugin will receive this event

{
 "event": "deviceDidDisconnect",
    "device": uniqueValue
}
MemberDescription
eventdeviceDidDisconnect
deviceValue used to identify the device

applicationDidLaunch

Plugins can request to be notified when certain applications are launched or terminated in their manifest.json. The manifest.json should include an object specifying a list of application identifiers to monitor. On macOS, use the application bundle identifier, and on Windows, use the exe file name. For example, the Apple Mail sample plugin uses the following:

"ApplicationsToMonitor": {
 "mac": [
  "com.apple.mail"
 ]
}

When a monitored application is launched, the plugin will receive this event

{
    "event": "applicationDidLaunch",
    "payload" : {
        "application": "com.apple.mail"
    }
}

applicationDidLaunch

When a monitored application is launched, the plugin will receive this event.

MemberDescription
eventapplicationDidLaunch
payloadA JSON object

The payload object contains the following members:

PayloadDescription
applicationThe identifier of the launched application

applicationDidTerminate

The plugin can request notifications when certain applications are launched or terminated in its manifest.json. The manifest.json should include an object specifying the list of application identifiers to monitor. On macOS, use the application bundle identifier, and on Windows, use the exe file name. For example, the Apple Mail sample plugin uses the following:

"ApplicationsToMonitor": {
 "mac": [
  "com.apple.mail"
 ]
}

When a monitored application terminates, the plugin will receive this event

{
    "event": "applicationDidTerminate",
    "payload" : {
        "application": "com.apple.mail"
    }
}
MemberDescription
eventapplicationDidLaunch
payloadA JSON object

The payload object contains the following members:

payloadDescription
applicationThe identifier of the terminated application

systemDidWakeUp

When the computer wakes up, the plugin will receive this event.

{
 "event": "systemDidWakeUp"
}
MemberDescription
eventsystemDidWakeUp

Important points to note:

  • The plugin may receive multiple systemDidWakeUp events when the computer wakes up.

  • The availability of the device cannot be guaranteed when the plugin receives the systemDidWakeUp event.

propertyInspectorDidAppear

When the property inspector appears, the plugin will receive this event.

{
  "action": "com.mirabox.demo.action1", 
  "event": "propertyInspectorDidAppear", 
  "context": uniqueValue, 
  "device": uniqueValue
}
MemberDescription
actionThe unique identifier for the action. Use this value to determine which action triggered the event if your plugin supports multiple actions.
eventpropertyInspectorDidAppear
contextIdentifier for the instance action
deviceIdentifier for the device

propertyInspectorDidDisappear

When the property inspector disappears, the plugin will receive this event.

{
    "action": "com.mirabox.demo.action1", 
    "event": "propertyInspectorDidDisappear", 
    "context": uniqueValue, 
    "device": uniqueValue
}
MemberDescription
actionThe unique identifier for the action. Use this value to determine which action triggered the event if your plugin supports multiple actions.
eventpropertyInspectorDidDisappear
contextIdentifier for the instance action
deviceIdentifier for the device

sendToPlugin

When the property inspector sends a sendToPlugin event, the plugin will receive this event.

{
    "action": "com.mirabox.demo.action1", 
    "event": "sendToPlugin", 
    "context": uniqueValue, 
    "payload": {<json data>}
}

sendToPropertyInspector

When the plugin sends a sendToPropertyInspector event, the property inspector will receive this event.

{
    "action": "com.mirabox.demo.action1", 
    "event": "sendToPropertyInspector", 
    "context": uniqueValue, 
    "payload": {<json data>}
}
Last Updated:
Contributors: Heart
Prev
Internationalization
Next
Events Sent