Documentation
¶
Index ¶
- type Action
- type ActionDescriptor
- type ActionInvokedSchemaJson
- type ActionInvokedSchemaJsonData
- type ActionInvokedSchemaJsonDataAction
- type ActionInvokedSchemaJsonDataActionParams
- type ActionParams
- type ActiveProfileChangedSchemaJson
- type ActiveProfileChangedSchemaJsonData
- type AutoSwitchRule
- type Binding
- type Color
- type CreateProfileSchemaJson
- type CreateProfileSchemaJsonParams
- type CreateProfileSchemaJsonResult
- type DelayActionParams
- type DeleteProfileSchemaJson
- type DeleteProfileSchemaJsonParams
- type DeleteProfileSchemaJsonResult
- type Device
- type DeviceID
- type DeviceRotation
- type DuplicateProfileSchemaJson
- type DuplicateProfileSchemaJsonParams
- type DuplicateProfileSchemaJsonResult
- type Error
- type ErrorDetails
- type Event
- type EventData
- type ExportProfileSchemaJson
- type ExportProfileSchemaJsonParams
- type ExportProfileSchemaJsonResult
- type ExportedProfile
- type GetAutoSwitchSchemaJson
- type GetAutoSwitchSchemaJsonParams
- type GetAutoSwitchSchemaJsonResult
- type HelloSchemaJson
- type HelloSchemaJsonParams
- type HelloSchemaJsonResult
- type ImportProfileSchemaJson
- type ImportProfileSchemaJsonParams
- type ImportProfileSchemaJsonResult
- type Input
- type InputAction
- type InputColor
- type InputEvent
- type InputFilter
- type InputKind
- type InputLayout
- type InputSchemaJson
- type InspectPluginSchemaJson
- type InspectPluginSchemaJsonParams
- type InspectPluginSchemaJsonResult
- type InstallPluginSchemaJson
- type InstallPluginSchemaJsonParams
- type InstallPluginSchemaJsonResult
- type InstalledPlugin
- type InstalledPluginStatus
- type LaunchAppActionParams
- type ListActionsSchemaJson
- type ListActionsSchemaJsonParams
- type ListActionsSchemaJsonResult
- type ListBindingsSchemaJson
- type ListBindingsSchemaJsonParams
- type ListBindingsSchemaJsonResult
- type ListDevicesSchemaJson
- type ListDevicesSchemaJsonParams
- type ListDevicesSchemaJsonResult
- type ListPluginsSchemaJson
- type ListPluginsSchemaJsonParams
- type ListPluginsSchemaJsonResult
- type ListProfilesSchemaJson
- type ListProfilesSchemaJsonParams
- type ListProfilesSchemaJsonResult
- type MacroActionParams
- type ParamSpec
- type ParamSpecType
- type PeerInfo
- type PluginAction
- type PluginCommand
- type PluginID
- type PluginLaunchInfo
- type PluginManifest
- type PluginManifestEntrypoint
- type Profile
- type RenameProfileSchemaJson
- type RenameProfileSchemaJsonParams
- type RenameProfileSchemaJsonResult
- type Request
- type RequestParams
- type Response
- type ResponseErr
- type ResponseOk
- type ResponseOkData
- type SendKeysActionParams
- type SetActiveProfileSchemaJson
- type SetActiveProfileSchemaJsonParams
- type SetActiveProfileSchemaJsonResult
- type SetAutoSwitchSchemaJson
- type SetAutoSwitchSchemaJsonParams
- type SetAutoSwitchSchemaJsonResult
- type SetBindingSchemaJson
- type SetBindingSchemaJsonParams
- type SetBindingSchemaJsonResult
- type SetColorActionParams
- type SetDeviceRotationSchemaJson
- type SetDeviceRotationSchemaJsonParams
- type SetDeviceRotationSchemaJsonResult
- type SetInputColorSchemaJson
- type SetInputColorSchemaJsonParams
- type SetInputColorSchemaJsonResult
- type ToggleActionParams
- type UninstallPluginSchemaJson
- type UninstallPluginSchemaJsonParams
- type UninstallPluginSchemaJsonResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
// Action-specific parameters. Schema depends on 'type'. The daemon validates them
// against the per-type ActionParams definition (e.g. DelayActionParams for type
// 'delay').
Params ActionParams `json:"params,omitempty,omitzero" yaml:"params,omitempty" mapstructure:"params,omitempty"`
// Action type. Built-ins are well-known; plugin actions use
// 'plugin.<plugin_id>.<action_id>'. Plugin ids are reverse-DNS (they contain
// dots) and action ids never do, so the action id is everything after the last
// dot.
Type string `json:"type" yaml:"type" mapstructure:"type"`
}
An executable action bound to an input.
func (*Action) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ActionDescriptor ¶ added in v0.3.0
type ActionDescriptor struct {
// Optional longer description of what the action does.
Description *string `json:"description,omitempty,omitzero" yaml:"description,omitempty" mapstructure:"description,omitempty"`
// Human-friendly action name for the UI.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// Params this action accepts, in display order.
Params []ParamSpec `json:"params" yaml:"params" mapstructure:"params"`
// Action type, as used in Action.type (e.g. 'launch_app').
Type string `json:"type" yaml:"type" mapstructure:"type"`
}
Describes a bindable action type and the params it accepts.
func (*ActionDescriptor) UnmarshalJSON ¶ added in v0.3.0
func (j *ActionDescriptor) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ActionInvokedSchemaJson ¶ added in v0.10.0
type ActionInvokedSchemaJson struct {
// Data corresponds to the JSON schema field "data".
Data ActionInvokedSchemaJsonData `json:"data" yaml:"data" mapstructure:"data"`
}
Sent by the daemon to a single plugin connection (never broadcast) when a binding or macro step whose action is 'plugin.<plugin_id>.<action_id>' fires for that plugin. Fire-and-forget: the daemon does not wait for the plugin, so a failing plugin action cannot stop a macro it is part of.
func (*ActionInvokedSchemaJson) UnmarshalJSON ¶ added in v0.10.0
func (j *ActionInvokedSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ActionInvokedSchemaJsonData ¶ added in v0.10.0
type ActionInvokedSchemaJsonData struct {
// The plugin action to run.
Action ActionInvokedSchemaJsonDataAction `json:"action" yaml:"action" mapstructure:"action"`
// Opaque id of the binding instance that fired: unique per binding and per step
// of a macro or of each list of a toggle, and stable for as long as that binding
// exists (also across daemon restarts). Lets a plugin keep per-instance state,
// e.g. a toggle bound to two keys. Plugins must not parse it.
Context string `json:"context" yaml:"context" mapstructure:"context"`
// Hardware event that fired the binding (e.g. lets a plugin tell rotate_cw from
// rotate_ccw). Absent when the action was not fired by hardware (e.g. a test run
// from the GUI).
Input *InputEvent `json:"input,omitempty,omitzero" yaml:"input,omitempty" mapstructure:"input,omitempty"`
}
func (*ActionInvokedSchemaJsonData) UnmarshalJSON ¶ added in v0.10.0
func (j *ActionInvokedSchemaJsonData) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ActionInvokedSchemaJsonDataAction ¶ added in v0.10.0
type ActionInvokedSchemaJsonDataAction struct {
// Action id as declared in the plugin manifest (PluginAction.id), without the
// 'plugin.<plugin_id>.' prefix.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Action.params from the binding, as configured by the user. Always present: {}
// when the binding has no params.
Params ActionInvokedSchemaJsonDataActionParams `json:"params" yaml:"params" mapstructure:"params"`
}
The plugin action to run.
func (*ActionInvokedSchemaJsonDataAction) UnmarshalJSON ¶ added in v0.10.0
func (j *ActionInvokedSchemaJsonDataAction) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ActionInvokedSchemaJsonDataActionParams ¶ added in v0.10.0
type ActionInvokedSchemaJsonDataActionParams map[string]interface{}
Action.params from the binding, as configured by the user. Always present: {} when the binding has no params.
type ActionParams ¶
type ActionParams map[string]interface{}
Action-specific parameters. Schema depends on 'type'. The daemon validates them against the per-type ActionParams definition (e.g. DelayActionParams for type 'delay').
type ActiveProfileChangedSchemaJson ¶ added in v0.6.0
type ActiveProfileChangedSchemaJson struct {
// Data corresponds to the JSON schema field "data".
Data ActiveProfileChangedSchemaJsonData `json:"data" yaml:"data" mapstructure:"data"`
}
Pushed by the daemon whenever the active profile changes on the server's own initiative (today: auto-switch by foreground app). Lets clients stay in sync without polling. Not emitted in response to a client's set_active_profile request, which already returns the new id.
func (*ActiveProfileChangedSchemaJson) UnmarshalJSON ¶ added in v0.6.0
func (j *ActiveProfileChangedSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ActiveProfileChangedSchemaJsonData ¶ added in v0.6.0
type ActiveProfileChangedSchemaJsonData struct {
// Identifier of the now-active profile.
ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
}
func (*ActiveProfileChangedSchemaJsonData) UnmarshalJSON ¶ added in v0.6.0
func (j *ActiveProfileChangedSchemaJsonData) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type AutoSwitchRule ¶ added in v0.6.0
type AutoSwitchRule struct {
// OS-native application identifier: bundle id on macOS, executable name on
// Linux/Windows. Opaque string, not portable across OSes; the daemon matches it
// verbatim against the frontmost app.
App string `json:"app" yaml:"app" mapstructure:"app"`
// Identifier of the profile to activate when this app is frontmost. Must
// reference an existing profile: set_auto_switch rejects unknown ids with
// PROFILE_NOT_FOUND, and delete_profile removes the rules pointing to the deleted
// profile.
ProfileId string `json:"profile_id" yaml:"profile_id" mapstructure:"profile_id"`
}
Maps a foreground application to the profile that should become active while that app is frontmost. When the frontmost app matches no rule, the active profile is left unchanged (sticky behavior); there is no fallback profile.
func (*AutoSwitchRule) UnmarshalJSON ¶ added in v0.6.0
func (j *AutoSwitchRule) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Binding ¶
type Binding struct {
// Action corresponds to the JSON schema field "action".
Action Action `json:"action" yaml:"action" mapstructure:"action"`
// DeviceId corresponds to the JSON schema field "device_id".
DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`
// InputId corresponds to the JSON schema field "input_id".
InputId string `json:"input_id" yaml:"input_id" mapstructure:"input_id"`
// Trigger corresponds to the JSON schema field "trigger".
Trigger InputAction `json:"trigger" yaml:"trigger" mapstructure:"trigger"`
}
Maps an input on a specific device to an action.
func (*Binding) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Color ¶ added in v0.12.0
type Color string
RGB color as a '#RRGGBB' hex string. Accepted in any case; the daemon stores and returns it lowercase, so clients can compare colors as strings. '#000000' turns the LED off. Hardware-agnostic: the daemon translates it to whatever the device understands (e.g. switching the device to a per-key lighting mode first).
func (*Color) UnmarshalJSON ¶ added in v0.12.0
UnmarshalJSON implements json.Unmarshaler.
type CreateProfileSchemaJson ¶ added in v0.4.0
type CreateProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params CreateProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result CreateProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Creates a new profile. The server generates the id and returns the profile with an empty bindings array.
func (*CreateProfileSchemaJson) UnmarshalJSON ¶ added in v0.4.0
func (j *CreateProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CreateProfileSchemaJsonParams ¶ added in v0.4.0
type CreateProfileSchemaJsonParams struct {
// Human-friendly name for the new profile.
Name string `json:"name" yaml:"name" mapstructure:"name"`
}
func (*CreateProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.4.0
func (j *CreateProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type CreateProfileSchemaJsonResult ¶ added in v0.4.0
type CreateProfileSchemaJsonResult struct {
// Profile corresponds to the JSON schema field "profile".
Profile Profile `json:"profile" yaml:"profile" mapstructure:"profile"`
}
func (*CreateProfileSchemaJsonResult) UnmarshalJSON ¶ added in v0.4.0
func (j *CreateProfileSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DelayActionParams ¶ added in v0.7.0
type DelayActionParams struct {
// Milliseconds to wait before continuing.
Ms int `json:"ms" yaml:"ms" mapstructure:"ms"`
}
Params for the built-in 'delay' action: waits for the given duration. Mainly useful as a step inside a macro.
func (*DelayActionParams) UnmarshalJSON ¶ added in v0.7.0
func (j *DelayActionParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DeleteProfileSchemaJson ¶ added in v0.4.0
type DeleteProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params DeleteProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result DeleteProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Deletes a profile. The daemon never deletes the last remaining profile. Deleting the active profile reassigns the active one, so the resulting active profile id is always returned. Auto-switch rules whose profile_id points to the deleted profile are deleted with it, so the stored rule set never references a missing profile.
func (*DeleteProfileSchemaJson) UnmarshalJSON ¶ added in v0.4.0
func (j *DeleteProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DeleteProfileSchemaJsonParams ¶ added in v0.4.0
type DeleteProfileSchemaJsonParams struct {
// Identifier of the profile to delete.
Id string `json:"id" yaml:"id" mapstructure:"id"`
}
func (*DeleteProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.4.0
func (j *DeleteProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DeleteProfileSchemaJsonResult ¶ added in v0.4.0
type DeleteProfileSchemaJsonResult struct {
// Identifier of the profile that is active after the deletion. Unchanged unless
// the deleted profile was the active one.
ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
}
func (*DeleteProfileSchemaJsonResult) UnmarshalJSON ¶ added in v0.4.0
func (j *DeleteProfileSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Device ¶
type Device struct {
// Id corresponds to the JSON schema field "id".
Id DeviceID `json:"id" yaml:"id" mapstructure:"id"`
// Inputs (keys/encoders) the daemon knows this device exposes. Empty for
// unrecognized devices the daemon can't map.
Inputs []Input `json:"inputs" yaml:"inputs" mapstructure:"inputs"`
// Manufacturer string from the HID descriptor. May be missing on cheap/clone
// devices.
Manufacturer *string `json:"manufacturer,omitempty,omitzero" yaml:"manufacturer,omitempty" mapstructure:"manufacturer,omitempty"`
// OS-opaque path used by the HID library to (re)open the device. Format varies
// per OS; clients should treat it as an opaque token.
Path string `json:"path" yaml:"path" mapstructure:"path"`
// Product name string from the HID descriptor.
Product *string `json:"product,omitempty,omitzero" yaml:"product,omitempty" mapstructure:"product,omitempty"`
// USB Product ID as a 4-digit hexadecimal string (lowercase or uppercase, no '0x'
// prefix).
ProductId string `json:"product_id" yaml:"product_id" mapstructure:"product_id"`
// Rotation corresponds to the JSON schema field "rotation".
Rotation *DeviceRotation `json:"rotation,omitempty,omitzero" yaml:"rotation,omitempty" mapstructure:"rotation,omitempty"`
// Serial number string from the HID descriptor. Not all HID devices expose one.
SerialNumber *string `json:"serial_number,omitempty,omitzero" yaml:"serial_number,omitempty" mapstructure:"serial_number,omitempty"`
// USB Vendor ID as a 4-digit hexadecimal string (lowercase or uppercase, no '0x'
// prefix).
VendorId string `json:"vendor_id" yaml:"vendor_id" mapstructure:"vendor_id"`
}
A HID device known to the daemon. Returned by list_devices.
func (*Device) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type DeviceID ¶
type DeviceID string
Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].
func (*DeviceID) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type DeviceRotation ¶ added in v0.13.0
type DeviceRotation int
func (*DeviceRotation) UnmarshalJSON ¶ added in v0.13.0
func (j *DeviceRotation) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DuplicateProfileSchemaJson ¶ added in v0.4.0
type DuplicateProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params DuplicateProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result DuplicateProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Creates a copy of an existing profile under a new name. The server generates a new id and copies the source profile's bindings. Does not change the active profile.
func (*DuplicateProfileSchemaJson) UnmarshalJSON ¶ added in v0.4.0
func (j *DuplicateProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DuplicateProfileSchemaJsonParams ¶ added in v0.4.0
type DuplicateProfileSchemaJsonParams struct {
// Identifier of the source profile to copy bindings from.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Human-friendly name for the new (duplicated) profile.
Name string `json:"name" yaml:"name" mapstructure:"name"`
}
func (*DuplicateProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.4.0
func (j *DuplicateProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type DuplicateProfileSchemaJsonResult ¶ added in v0.4.0
type DuplicateProfileSchemaJsonResult struct {
// Profile corresponds to the JSON schema field "profile".
Profile Profile `json:"profile" yaml:"profile" mapstructure:"profile"`
}
func (*DuplicateProfileSchemaJsonResult) UnmarshalJSON ¶ added in v0.4.0
func (j *DuplicateProfileSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Error ¶
type Error struct {
// Stable, machine-readable error code in SCREAMING_SNAKE_CASE.
Code string `json:"code" yaml:"code" mapstructure:"code"`
// Optional structured context for debugging.
Details ErrorDetails `json:"details,omitempty,omitzero" yaml:"details,omitempty" mapstructure:"details,omitempty"`
// Human-readable error message. Free form, may be localized in future versions.
Message string `json:"message" yaml:"message" mapstructure:"message"`
}
Failure payload returned in a Response with ok=false.
func (*Error) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ErrorDetails ¶
type ErrorDetails map[string]interface{}
Optional structured context for debugging.
type Event ¶
type Event struct {
// Event-specific payload. Refined by the schema in
// schemas/events/<name>.schema.json.
Data EventData `json:"data" yaml:"data" mapstructure:"data"`
// Event name in snake_case.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// Type corresponds to the JSON schema field "type".
Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}
Server -> client, no correlation. Stream of hardware events or daemon notifications.
func (*Event) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type EventData ¶
type EventData map[string]interface{}
Event-specific payload. Refined by the schema in schemas/events/<name>.schema.json.
type ExportProfileSchemaJson ¶ added in v0.8.0
type ExportProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params ExportProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ExportProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Serializes the profile identified by 'id' as a portable ExportedProfile document and writes it to 'path' on the daemon host's filesystem. The exported file omits the server-local id. Returns the path that was written.
func (*ExportProfileSchemaJson) UnmarshalJSON ¶ added in v0.8.0
func (j *ExportProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ExportProfileSchemaJsonParams ¶ added in v0.8.0
type ExportProfileSchemaJsonParams struct {
// Identifier of the profile to export.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Filesystem path on the daemon host where the exported file is written.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
func (*ExportProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.8.0
func (j *ExportProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ExportProfileSchemaJsonResult ¶ added in v0.8.0
type ExportProfileSchemaJsonResult struct {
// Echo of the path that was written.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
func (*ExportProfileSchemaJsonResult) UnmarshalJSON ¶ added in v0.8.0
func (j *ExportProfileSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ExportedProfile ¶ added in v0.8.0
type ExportedProfile struct {
// Bindings that belong to the exported profile.
Bindings []Binding `json:"bindings" yaml:"bindings" mapstructure:"bindings"`
// LED colors of the exported profile. Same semantics as Profile.colors.
Colors []InputColor `json:"colors,omitempty,omitzero" yaml:"colors,omitempty" mapstructure:"colors,omitempty"`
// Magic marker identifying the file as a KeyForge profile export.
Format string `json:"format" yaml:"format" mapstructure:"format"`
// Human-friendly profile name.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// Export format version. Currently 1; bumped if the on-disk shape changes.
Version int `json:"version" yaml:"version" mapstructure:"version"`
}
Portable, on-disk representation of a profile, written by export_profile and read by import_profile. Carries no server-local id: the id is meaningless outside the originating installation, so import always assigns a fresh one. The 'version' field lets readers detect and adapt to format changes.
func (*ExportedProfile) UnmarshalJSON ¶ added in v0.8.0
func (j *ExportedProfile) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type GetAutoSwitchSchemaJson ¶ added in v0.6.0
type GetAutoSwitchSchemaJson struct {
// No parameters in v1.
Params GetAutoSwitchSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result GetAutoSwitchSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Returns the current auto-switch configuration: the master toggle and the full set of app-to-profile rules. The daemon uses these to switch the active profile based on the foreground application.
func (*GetAutoSwitchSchemaJson) UnmarshalJSON ¶ added in v0.6.0
func (j *GetAutoSwitchSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type GetAutoSwitchSchemaJsonParams ¶ added in v0.6.0
type GetAutoSwitchSchemaJsonParams map[string]interface{}
No parameters in v1.
type GetAutoSwitchSchemaJsonResult ¶ added in v0.6.0
type GetAutoSwitchSchemaJsonResult struct {
// Master toggle. When false, the daemon ignores the rules and never
// auto-switches.
Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
// App-to-profile rules currently configured.
Rules []AutoSwitchRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}
func (*GetAutoSwitchSchemaJsonResult) UnmarshalJSON ¶ added in v0.6.0
func (j *GetAutoSwitchSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type HelloSchemaJson ¶
type HelloSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params HelloSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result HelloSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Mandatory first request after a WebSocket connection is established. The client declares the protocol_version it speaks. The server either accepts (Response.ok=true with its own identification) or closes the connection with an UNSUPPORTED_PROTOCOL_VERSION error. After a successful hello no further version negotiation happens; the contract is fixed for the session.
func (*HelloSchemaJson) UnmarshalJSON ¶
func (j *HelloSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type HelloSchemaJsonParams ¶
type HelloSchemaJsonParams struct {
// Client corresponds to the JSON schema field "client".
Client PeerInfo `json:"client" yaml:"client" mapstructure:"client"`
// Major version of the protocol the client implements. Currently '1'.
ProtocolVersion string `json:"protocol_version" yaml:"protocol_version" mapstructure:"protocol_version"`
}
func (*HelloSchemaJsonParams) UnmarshalJSON ¶
func (j *HelloSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type HelloSchemaJsonResult ¶
type HelloSchemaJsonResult struct {
// Protocol version the server agrees to speak for this session.
ProtocolVersion string `json:"protocol_version" yaml:"protocol_version" mapstructure:"protocol_version"`
// Server corresponds to the JSON schema field "server".
Server PeerInfo `json:"server" yaml:"server" mapstructure:"server"`
}
func (*HelloSchemaJsonResult) UnmarshalJSON ¶
func (j *HelloSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ImportProfileSchemaJson ¶ added in v0.8.0
type ImportProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params ImportProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ImportProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Reads an ExportedProfile document from 'path' on the daemon host's filesystem, validates it, and creates a new profile from it. The server generates a fresh id; any id in the file is ignored. Does not change the active profile. Returns the created profile.
func (*ImportProfileSchemaJson) UnmarshalJSON ¶ added in v0.8.0
func (j *ImportProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ImportProfileSchemaJsonParams ¶ added in v0.8.0
type ImportProfileSchemaJsonParams struct {
// Filesystem path on the daemon host of the exported file to import.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
func (*ImportProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.8.0
func (j *ImportProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ImportProfileSchemaJsonResult ¶ added in v0.8.0
type ImportProfileSchemaJsonResult struct {
// Profile corresponds to the JSON schema field "profile".
Profile Profile `json:"profile" yaml:"profile" mapstructure:"profile"`
}
func (*ImportProfileSchemaJsonResult) UnmarshalJSON ¶ added in v0.8.0
func (j *ImportProfileSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Input ¶ added in v0.3.0
type Input struct {
// Color the active profile paints on this input. Only set on RGB inputs that have
// a color in the active profile; absent means the LED is off.
Color *Color `json:"color,omitempty,omitzero" yaml:"color,omitempty" mapstructure:"color,omitempty"`
// Logical identifier of the input within the device (e.g. 'key_0x04',
// 'encoder_0'). Matches InputEvent.input_id and Binding.input_id.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Kind corresponds to the JSON schema field "kind".
Kind InputKind `json:"kind" yaml:"kind" mapstructure:"kind"`
// Fixed name of the input (e.g. 'Enter', 'Play') that clients show as-is in any
// orientation. When absent, clients name the input by position: they number
// inputs per kind in reading order of the current view, sorting by each input's
// top-left corner after applying Device.rotation (y first, then x), so 'Key 1' is
// always the top-left key as the device sits on the desk. If the device has no
// complete layout, they number inputs per kind in the order list_devices returns
// them. Catalogs should not send positional labels like 'Key 1': they would be
// wrong once the device is rotated.
Label *string `json:"label,omitempty,omitzero" yaml:"label,omitempty" mapstructure:"label,omitempty"`
// Layout corresponds to the JSON schema field "layout".
Layout *InputLayout `json:"layout,omitempty,omitzero" yaml:"layout,omitempty" mapstructure:"layout,omitempty"`
// Whether the input has an RGB LED the daemon can drive through set_input_color.
// Absent means false.
Rgb *bool `json:"rgb,omitempty,omitzero" yaml:"rgb,omitempty" mapstructure:"rgb,omitempty"`
}
A single physical input exposed by a device (a key or an encoder).
func (*Input) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON implements json.Unmarshaler.
type InputAction ¶
type InputAction string
const InputActionClick InputAction = "click"
const InputActionPress InputAction = "press"
const InputActionRelease InputAction = "release"
const InputActionRotateCcw InputAction = "rotate_ccw"
const InputActionRotateCw InputAction = "rotate_cw"
func (*InputAction) UnmarshalJSON ¶
func (j *InputAction) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InputColor ¶ added in v0.12.0
type InputColor struct {
// Color corresponds to the JSON schema field "color".
Color Color `json:"color" yaml:"color" mapstructure:"color"`
// DeviceId corresponds to the JSON schema field "device_id".
DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`
// Logical identifier of the input within the device. Matches Device.inputs[].id.
InputId string `json:"input_id" yaml:"input_id" mapstructure:"input_id"`
}
LED color assigned to one input of a device.
func (*InputColor) UnmarshalJSON ¶ added in v0.12.0
func (j *InputColor) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InputEvent ¶
type InputEvent struct {
// Action corresponds to the JSON schema field "action".
Action InputAction `json:"action" yaml:"action" mapstructure:"action"`
// DeviceId corresponds to the JSON schema field "device_id".
DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`
// Logical identifier of the input within the device (e.g. 'key_0x04',
// 'encoder_0'). Matches Device.inputs[].id.
InputId string `json:"input_id" yaml:"input_id" mapstructure:"input_id"`
// Kind corresponds to the JSON schema field "kind".
Kind InputKind `json:"kind" yaml:"kind" mapstructure:"kind"`
// Unix epoch in milliseconds when the event was captured by the daemon.
TimestampMs int `json:"timestamp_ms" yaml:"timestamp_ms" mapstructure:"timestamp_ms"`
}
A single hardware event coming from a HID device.
func (*InputEvent) UnmarshalJSON ¶
func (j *InputEvent) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InputFilter ¶ added in v0.15.0
type InputFilter struct {
// Only inputs of these kinds. Absent means any kind.
Kinds []InputKind `json:"kinds,omitempty,omitzero" yaml:"kinds,omitempty" mapstructure:"kinds,omitempty"`
// true: only inputs with an LED (Input.rgb). false or absent: no filtering by
// LED.
Rgb *bool `json:"rgb,omitempty,omitzero" yaml:"rgb,omitempty" mapstructure:"rgb,omitempty"`
}
Narrows which inputs a ParamSpec of type 'input' lets the user pick. Only valid with type 'input': a ParamSpec of any other type that carries it is rejected. Absent means any input of the device.
func (*InputFilter) UnmarshalJSON ¶ added in v0.15.0
func (j *InputFilter) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InputKind ¶
type InputKind string
const InputKindEncoder InputKind = "encoder"
const InputKindKey InputKind = "key"
func (*InputKind) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type InputLayout ¶ added in v0.13.0
type InputLayout struct {
// Height in key units. Absent means 1.
H *float64 `json:"h,omitempty,omitzero" yaml:"h,omitempty" mapstructure:"h,omitempty"`
// Width in key units. Absent means 1.
W *float64 `json:"w,omitempty,omitzero" yaml:"w,omitempty" mapstructure:"w,omitempty"`
// Horizontal position of the input's top-left corner, in key units.
X float64 `json:"x" yaml:"x" mapstructure:"x"`
// Vertical position of the input's top-left corner, in key units. Grows
// downwards.
Y float64 `json:"y" yaml:"y" mapstructure:"y"`
}
Physical position and size of an input, in key units (1 = one standard key). Fractions are allowed (e.g. x: 5.5 leaves a gap before a column of encoders). Coordinates are in the device's canonical orientation, defined by the daemon's device catalog: the origin is the top-left corner and y grows downwards. This is a coordinate system, not how the user has the device on the desk (that is Device.rotation). The shape is not modeled: clients derive it from Input.kind (key = rectangle, encoder = circle). Clients can draw a device only when every one of its inputs has a layout; otherwise they fall back to a view without positions (e.g. a list). Prior art: the {x, y, w, h} key model of QMK/VIA info.json.
func (*InputLayout) UnmarshalJSON ¶ added in v0.13.0
func (j *InputLayout) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InputSchemaJson ¶
type InputSchemaJson struct {
// Data corresponds to the JSON schema field "data".
Data InputEvent `json:"data" yaml:"data" mapstructure:"data"`
}
Pushed by the daemon for every hardware event captured on a connected HID device. High-frequency: encoders may emit many per second.
func (*InputSchemaJson) UnmarshalJSON ¶
func (j *InputSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InspectPluginSchemaJson ¶ added in v0.11.0
type InspectPluginSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params InspectPluginSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result InspectPluginSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Opens the '.keyforgeplugin' package at 'path' on the daemon host's filesystem and validates it exactly as install_plugin would (including rejecting a package with no entrypoint for the daemon host's OS), without installing or changing anything. Lets a client show a confirmation (name, author, version, actions) before installing.
func (*InspectPluginSchemaJson) UnmarshalJSON ¶ added in v0.11.0
func (j *InspectPluginSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InspectPluginSchemaJsonParams ¶ added in v0.11.0
type InspectPluginSchemaJsonParams struct {
// Filesystem path on the daemon host of the '.keyforgeplugin' package.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
func (*InspectPluginSchemaJsonParams) UnmarshalJSON ¶ added in v0.11.0
func (j *InspectPluginSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InspectPluginSchemaJsonResult ¶ added in v0.11.0
type InspectPluginSchemaJsonResult struct {
// Version of the plugin with the same id that is currently installed, if any.
// Installing the package would replace it.
InstalledVersion *string `json:"installed_version,omitempty,omitzero" yaml:"installed_version,omitempty" mapstructure:"installed_version,omitempty"`
// Manifest corresponds to the JSON schema field "manifest".
Manifest PluginManifest `json:"manifest" yaml:"manifest" mapstructure:"manifest"`
}
func (*InspectPluginSchemaJsonResult) UnmarshalJSON ¶ added in v0.11.0
func (j *InspectPluginSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InstallPluginSchemaJson ¶ added in v0.11.0
type InstallPluginSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params InstallPluginSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result InstallPluginSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Installs the '.keyforgeplugin' package at 'path' on the daemon host's filesystem: validates it, extracts it into '<config dir>/plugins/<id>/' and starts the plugin. A package with no entrypoint for the daemon host's OS is rejected with an error and nothing is installed. The response is sent right after spawning, so the returned status is normally 'starting'; clients refresh with list_plugins. If a plugin with the same id is already installed, it is replaced (upgrade): the old process is stopped and its folder swapped atomically. Bindings are never modified, so existing bindings to the plugin's actions keep working after an upgrade.
func (*InstallPluginSchemaJson) UnmarshalJSON ¶ added in v0.11.0
func (j *InstallPluginSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InstallPluginSchemaJsonParams ¶ added in v0.11.0
type InstallPluginSchemaJsonParams struct {
// Filesystem path on the daemon host of the '.keyforgeplugin' package.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
func (*InstallPluginSchemaJsonParams) UnmarshalJSON ¶ added in v0.11.0
func (j *InstallPluginSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InstallPluginSchemaJsonResult ¶ added in v0.11.0
type InstallPluginSchemaJsonResult struct {
// Plugin corresponds to the JSON schema field "plugin".
Plugin InstalledPlugin `json:"plugin" yaml:"plugin" mapstructure:"plugin"`
// Version that was replaced, present only when the install was an upgrade.
PreviousVersion *string `json:"previous_version,omitempty,omitzero" yaml:"previous_version,omitempty" mapstructure:"previous_version,omitempty"`
}
func (*InstallPluginSchemaJsonResult) UnmarshalJSON ¶ added in v0.11.0
func (j *InstallPluginSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InstalledPlugin ¶ added in v0.11.0
type InstalledPlugin struct {
// Human-readable reason why the plugin failed. The daemon sets it only when
// status is 'error' (not enforced by the schema).
Error *string `json:"error,omitempty,omitzero" yaml:"error,omitempty" mapstructure:"error,omitempty"`
// Manifest corresponds to the JSON schema field "manifest".
Manifest PluginManifest `json:"manifest" yaml:"manifest" mapstructure:"manifest"`
// State of the plugin process: 'starting' (spawned, hello not received yet),
// 'running' (connected), 'stopped' (not running, e.g. exited cleanly) or 'error'
// (failed to start or crashed; see 'error').
Status InstalledPluginStatus `json:"status" yaml:"status" mapstructure:"status"`
}
A plugin installed in the daemon, with the state of its process.
func (*InstalledPlugin) UnmarshalJSON ¶ added in v0.11.0
func (j *InstalledPlugin) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type InstalledPluginStatus ¶ added in v0.11.0
type InstalledPluginStatus string
const InstalledPluginStatusError InstalledPluginStatus = "error"
const InstalledPluginStatusRunning InstalledPluginStatus = "running"
const InstalledPluginStatusStarting InstalledPluginStatus = "starting"
const InstalledPluginStatusStopped InstalledPluginStatus = "stopped"
func (*InstalledPluginStatus) UnmarshalJSON ¶ added in v0.11.0
func (j *InstalledPluginStatus) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type LaunchAppActionParams ¶ added in v0.7.0
type LaunchAppActionParams struct {
// Absolute path to the application or executable to launch.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
Params for the built-in 'launch_app' action: launches an application.
func (*LaunchAppActionParams) UnmarshalJSON ¶ added in v0.7.0
func (j *LaunchAppActionParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListActionsSchemaJson ¶ added in v0.3.0
type ListActionsSchemaJson struct {
// No parameters in v1.
Params ListActionsSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ListActionsSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Returns the catalog of actions the daemon can bind to inputs, including the param shape each action needs so a client can render a config form. No params in v1.
func (*ListActionsSchemaJson) UnmarshalJSON ¶ added in v0.3.0
func (j *ListActionsSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListActionsSchemaJsonParams ¶ added in v0.3.0
type ListActionsSchemaJsonParams map[string]interface{}
No parameters in v1.
type ListActionsSchemaJsonResult ¶ added in v0.3.0
type ListActionsSchemaJsonResult struct {
// All actions available to bind. Built-ins plus any registered plugin actions.
Actions []ActionDescriptor `json:"actions" yaml:"actions" mapstructure:"actions"`
}
func (*ListActionsSchemaJsonResult) UnmarshalJSON ¶ added in v0.3.0
func (j *ListActionsSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListBindingsSchemaJson ¶ added in v0.3.0
type ListBindingsSchemaJson struct {
// No parameters in v1.
Params ListBindingsSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ListBindingsSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Returns all bindings the daemon currently has configured. Read-side counterpart of set_binding. No filters in v1; clients filter client-side if needed.
func (*ListBindingsSchemaJson) UnmarshalJSON ¶ added in v0.3.0
func (j *ListBindingsSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListBindingsSchemaJsonParams ¶ added in v0.3.0
type ListBindingsSchemaJsonParams map[string]interface{}
No parameters in v1.
type ListBindingsSchemaJsonResult ¶ added in v0.3.0
type ListBindingsSchemaJsonResult struct {
// All currently configured bindings.
Bindings []Binding `json:"bindings" yaml:"bindings" mapstructure:"bindings"`
}
func (*ListBindingsSchemaJsonResult) UnmarshalJSON ¶ added in v0.3.0
func (j *ListBindingsSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListDevicesSchemaJson ¶
type ListDevicesSchemaJson struct {
// No parameters in v1.
Params ListDevicesSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ListDevicesSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Returns the HID devices currently known to the daemon. No filters in v1; clients filter client-side if needed.
func (*ListDevicesSchemaJson) UnmarshalJSON ¶
func (j *ListDevicesSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListDevicesSchemaJsonParams ¶
type ListDevicesSchemaJsonParams map[string]interface{}
No parameters in v1.
type ListDevicesSchemaJsonResult ¶
type ListDevicesSchemaJsonResult struct {
// All currently enumerated HID devices.
Devices []Device `json:"devices" yaml:"devices" mapstructure:"devices"`
}
func (*ListDevicesSchemaJsonResult) UnmarshalJSON ¶
func (j *ListDevicesSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListPluginsSchemaJson ¶ added in v0.11.0
type ListPluginsSchemaJson struct {
// No parameters in v1.
Params ListPluginsSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ListPluginsSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Returns every installed plugin with the state of its process. No params in v1.
func (*ListPluginsSchemaJson) UnmarshalJSON ¶ added in v0.11.0
func (j *ListPluginsSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListPluginsSchemaJsonParams ¶ added in v0.11.0
type ListPluginsSchemaJsonParams map[string]interface{}
No parameters in v1.
type ListPluginsSchemaJsonResult ¶ added in v0.11.0
type ListPluginsSchemaJsonResult struct {
// Installed plugins.
Plugins []InstalledPlugin `json:"plugins" yaml:"plugins" mapstructure:"plugins"`
}
func (*ListPluginsSchemaJsonResult) UnmarshalJSON ¶ added in v0.11.0
func (j *ListPluginsSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListProfilesSchemaJson ¶ added in v0.4.0
type ListProfilesSchemaJson struct {
// No parameters in v1.
Params ListProfilesSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result ListProfilesSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Returns all profiles the daemon currently has, along with the id of the active one. The active profile id is tracked at the daemon level and only exposed here.
func (*ListProfilesSchemaJson) UnmarshalJSON ¶ added in v0.4.0
func (j *ListProfilesSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ListProfilesSchemaJsonParams ¶ added in v0.4.0
type ListProfilesSchemaJsonParams map[string]interface{}
No parameters in v1.
type ListProfilesSchemaJsonResult ¶ added in v0.4.0
type ListProfilesSchemaJsonResult struct {
// Identifier of the currently active profile. Always references one of the
// profiles in the array.
ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
// All profiles known to the daemon.
Profiles []Profile `json:"profiles" yaml:"profiles" mapstructure:"profiles"`
}
func (*ListProfilesSchemaJsonResult) UnmarshalJSON ¶ added in v0.4.0
func (j *ListProfilesSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type MacroActionParams ¶ added in v0.7.0
type MacroActionParams struct {
// Actions to run in order. Must contain at least one step.
Steps []Action `json:"steps" yaml:"steps" mapstructure:"steps"`
}
Params for the built-in 'macro' action: runs a sequence of actions in order. The schema allows any Action as a step; the daemon rejects steps whose type is 'macro' or 'toggle'.
func (*MacroActionParams) UnmarshalJSON ¶ added in v0.7.0
func (j *MacroActionParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ParamSpec ¶ added in v0.3.0
type ParamSpec struct {
// InputFilter corresponds to the JSON schema field "input_filter".
InputFilter *InputFilter `json:"input_filter,omitempty,omitzero" yaml:"input_filter,omitempty" mapstructure:"input_filter,omitempty"`
// Human-friendly field label.
Label string `json:"label" yaml:"label" mapstructure:"label"`
// Param key written into Action.params. Unique within the action.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// For 'string': placeholder/example shown in the text field. For 'input': label
// of the picker's 'nothing picked' option in an optional param, describing what
// the action does when no input is picked (e.g. set_color: 'This key (the one
// that fired)'); a required 'input' param has no such option, so clients ignore
// it. Does not apply to 'boolean' or 'color'.
Placeholder *string `json:"placeholder,omitempty,omitzero" yaml:"placeholder,omitempty" mapstructure:"placeholder,omitempty"`
// Required corresponds to the JSON schema field "required".
Required bool `json:"required" yaml:"required" mapstructure:"required"`
// Param value type, which sets the JSON type written into Action.params: 'string'
// a string, 'boolean' a boolean, 'color' a Color ('#RRGGBB' string, rendered as a
// color picker), 'input' a string holding the Input.id of an input on the same
// device as the binding that fires the action. An optional boolean that is absent
// means false. placeholder only applies to 'string' and 'input'. 'input' is
// rendered as a picker listing that device's inputs (narrowed by input_filter),
// named and ordered as in the visual editor: Input.label, or numbered per kind in
// reading order of the rotated view. An optional 'input' that is absent means
// nothing was picked; each action defines what that means (for set_color, the
// input that fired the action). The stored value is always the Input.id (the
// physical input), never a position or a numbered label: Device.rotation is
// presentation only, so rotating the device after saving does not change which
// physical input the param targets, while the label the picker shows for it does
// change (at 180 degrees the top-left key becomes the bottom-right one). Clients
// translate both ways with the current rotation: label to id when picking, id to
// label when showing a saved value. Whether the id exists on the device is
// checked when the action runs, not when the binding is saved (the device may be
// disconnected).
Type ParamSpecType `json:"type" yaml:"type" mapstructure:"type"`
}
Describes one action parameter so a client can render an input for it.
func (*ParamSpec) UnmarshalJSON ¶ added in v0.3.0
UnmarshalJSON implements json.Unmarshaler.
type ParamSpecType ¶ added in v0.3.0
type ParamSpecType string
const ParamSpecTypeBoolean ParamSpecType = "boolean"
const ParamSpecTypeColor ParamSpecType = "color"
const ParamSpecTypeInput ParamSpecType = "input"
const ParamSpecTypeString ParamSpecType = "string"
func (*ParamSpecType) UnmarshalJSON ¶ added in v0.3.0
func (j *ParamSpecType) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PeerInfo ¶
type PeerInfo struct {
// Stable identifier of the peer implementation. A plugin must send its PluginID
// here; the daemon checks it against the plugin its auth token belongs to.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// Semver version of the peer build.
Version string `json:"version" yaml:"version" mapstructure:"version"`
}
Self-identification of a protocol peer (client or server).
func (*PeerInfo) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type PluginAction ¶ added in v0.9.0
type PluginAction struct {
// Optional longer description of what the action does.
Description *string `json:"description,omitempty,omitzero" yaml:"description,omitempty" mapstructure:"description,omitempty"`
// Action identifier, unique within the plugin. snake_case, no dots.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Input kinds the action can be bound to. Omitted means any kind.
Inputs []InputKind `json:"inputs,omitempty,omitzero" yaml:"inputs,omitempty" mapstructure:"inputs,omitempty"`
// Human-friendly action name for the UI.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// Params this action accepts, in display order.
Params []ParamSpec `json:"params" yaml:"params" mapstructure:"params"`
}
An action a plugin exposes, declared in its manifest.
func (*PluginAction) UnmarshalJSON ¶ added in v0.9.0
func (j *PluginAction) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PluginCommand ¶ added in v0.9.0
type PluginCommand struct {
// Arguments passed to the executable.
Args []string `json:"args,omitempty,omitzero" yaml:"args,omitempty" mapstructure:"args,omitempty"`
// Executable to run. A path containing '/' is resolved relative to the plugin
// root; a bare name (e.g. 'node') is looked up on the PATH. Always use '/' as
// separator, also on Windows; absolute paths, '\' and ':' are not allowed.
Path string `json:"path" yaml:"path" mapstructure:"path"`
}
Executable plus arguments used to start a plugin process.
func (*PluginCommand) UnmarshalJSON ¶ added in v0.9.0
func (j *PluginCommand) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PluginID ¶ added in v0.10.0
type PluginID string
Globally unique plugin identifier in reverse-DNS form (e.g. 'dev.jonidg.spotify'). Lowercase, at least two dot-separated segments, each starting with a letter. Used as the install folder name and as <plugin_id> in Action.type.
func (*PluginID) UnmarshalJSON ¶ added in v0.10.0
UnmarshalJSON implements json.Unmarshaler.
type PluginLaunchInfo ¶ added in v0.10.0
type PluginLaunchInfo struct {
// Id of the plugin being launched (its manifest id).
PluginId PluginID `json:"plugin_id" yaml:"plugin_id" mapstructure:"plugin_id"`
// Protocol major version the daemon speaks. The plugin sends it back in hello.
// Currently '1'.
ProtocolVersion string `json:"protocol_version" yaml:"protocol_version" mapstructure:"protocol_version"`
// WebSocket URL to connect to, including the per-plugin auth token as a query
// param. Treat it as a secret: the token identifies the plugin to the daemon and
// is distinct from the GUI's session token.
WsUrl string `json:"ws_url" yaml:"ws_url" mapstructure:"ws_url"`
}
Connection info the daemon hands to a plugin process it spawns, serialized as JSON in the KEYFORGE_PLUGIN_INFO environment variable (an env var rather than CLI args, so the token is not visible in the process list). The plugin connects to ws_url, sends hello with client.name set to plugin_id, and must exit when that connection closes.
func (*PluginLaunchInfo) UnmarshalJSON ¶ added in v0.10.0
func (j *PluginLaunchInfo) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PluginManifest ¶ added in v0.9.0
type PluginManifest struct {
// Actions the plugin exposes. Each becomes bindable as 'plugin.<id>.<action id>'.
Actions []PluginAction `json:"actions" yaml:"actions" mapstructure:"actions"`
// Plugin author, shown in the UI.
Author *string `json:"author,omitempty,omitzero" yaml:"author,omitempty" mapstructure:"author,omitempty"`
// Category the UI groups the plugin's actions under (e.g. 'Audio', 'Streaming').
Category *string `json:"category,omitempty,omitzero" yaml:"category,omitempty" mapstructure:"category,omitempty"`
// Short description of what the plugin does.
Description *string `json:"description,omitempty,omitzero" yaml:"description,omitempty" mapstructure:"description,omitempty"`
// Command the daemon runs to start the plugin, per OS (keys match Go's GOOS). The
// plugin supports exactly the OSes listed here.
Entrypoint PluginManifestEntrypoint `json:"entrypoint" yaml:"entrypoint" mapstructure:"entrypoint"`
// URL of the plugin homepage or source repository.
Homepage *string `json:"homepage,omitempty,omitzero" yaml:"homepage,omitempty" mapstructure:"homepage,omitempty"`
// Path to the plugin icon, relative to the plugin root. No leading '/', no '\'
// and no ':'.
Icon *string `json:"icon,omitempty,omitzero" yaml:"icon,omitempty" mapstructure:"icon,omitempty"`
// Globally unique reverse-DNS plugin id; install folder name and <plugin_id> in
// Action.type.
Id PluginID `json:"id" yaml:"id" mapstructure:"id"`
// Manifest format version. Currently 1; bumped if the manifest shape changes.
ManifestVersion int `json:"manifest_version" yaml:"manifest_version" mapstructure:"manifest_version"`
// Human-friendly plugin name for the UI.
Name string `json:"name" yaml:"name" mapstructure:"name"`
// Major version of the protocol the plugin speaks. Lets the daemon reject an
// incompatible plugin before spawning it. Currently '1'.
ProtocolVersion string `json:"protocol_version" yaml:"protocol_version" mapstructure:"protocol_version"`
// Plugin version (SemVer 2.0).
Version string `json:"version" yaml:"version" mapstructure:"version"`
}
Contents of the manifest.json file at the root of a plugin. A plugin is distributed as a '.keyforgeplugin' file: a zip archive with manifest.json at its root (no wrapping folder) plus every file the manifest references. The daemon installs it by extracting the archive into '<config dir>/plugins/<id>/', taking the id from the manifest. All file paths in the manifest (icon, and entrypoint paths containing '/') are relative to the plugin root, use '/' as separator, and must stay inside the plugin root: the daemon rejects '..' segments and any path or archive entry that escapes the root.
func (*PluginManifest) UnmarshalJSON ¶ added in v0.9.0
func (j *PluginManifest) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type PluginManifestEntrypoint ¶ added in v0.9.0
type PluginManifestEntrypoint struct {
// Darwin corresponds to the JSON schema field "darwin".
Darwin *PluginCommand `json:"darwin,omitempty,omitzero" yaml:"darwin,omitempty" mapstructure:"darwin,omitempty"`
// Linux corresponds to the JSON schema field "linux".
Linux *PluginCommand `json:"linux,omitempty,omitzero" yaml:"linux,omitempty" mapstructure:"linux,omitempty"`
// Windows corresponds to the JSON schema field "windows".
Windows *PluginCommand `json:"windows,omitempty,omitzero" yaml:"windows,omitempty" mapstructure:"windows,omitempty"`
}
Command the daemon runs to start the plugin, per OS (keys match Go's GOOS). The plugin supports exactly the OSes listed here.
type Profile ¶ added in v0.4.0
type Profile struct {
// Bindings that belong to this profile.
Bindings []Binding `json:"bindings" yaml:"bindings" mapstructure:"bindings"`
// LED colors this profile paints on RGB-capable inputs, applied by the daemon
// whenever the profile becomes active. An RGB input with no entry here is turned
// off. At most one entry per (device_id, input_id); the daemon enforces
// uniqueness. Absent means no colors.
Colors []InputColor `json:"colors,omitempty,omitzero" yaml:"colors,omitempty" mapstructure:"colors,omitempty"`
// Stable server-generated identifier for the profile.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Human-friendly profile name.
Name string `json:"name" yaml:"name" mapstructure:"name"`
}
A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.
func (*Profile) UnmarshalJSON ¶ added in v0.4.0
UnmarshalJSON implements json.Unmarshaler.
type RenameProfileSchemaJson ¶ added in v0.4.0
type RenameProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params RenameProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Empty acknowledgement object. Reserved for future fields without breaking the
// schema.
Result RenameProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Renames an existing profile. Does not affect its bindings or the active profile.
func (*RenameProfileSchemaJson) UnmarshalJSON ¶ added in v0.4.0
func (j *RenameProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RenameProfileSchemaJsonParams ¶ added in v0.4.0
type RenameProfileSchemaJsonParams struct {
// Identifier of the profile to rename.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// New human-friendly name for the profile.
Name string `json:"name" yaml:"name" mapstructure:"name"`
}
func (*RenameProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.4.0
func (j *RenameProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type RenameProfileSchemaJsonResult ¶ added in v0.4.0
type RenameProfileSchemaJsonResult map[string]interface{}
Empty acknowledgement object. Reserved for future fields without breaking the schema.
type Request ¶
type Request struct {
// Client-generated correlation id (UUID v4 or nanoid).
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Method name in snake_case.
Method string `json:"method" yaml:"method" mapstructure:"method"`
// Method-specific arguments. Refined by the schema in
// schemas/methods/<method>.schema.json.
Params RequestParams `json:"params" yaml:"params" mapstructure:"params"`
// Type corresponds to the JSON schema field "type".
Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}
Client -> server. Expects a correlated Response with the same id.
func (*Request) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type RequestParams ¶
type RequestParams map[string]interface{}
Method-specific arguments. Refined by the schema in schemas/methods/<method>.schema.json.
type ResponseErr ¶
type ResponseErr struct {
// Error corresponds to the JSON schema field "error".
Error Error `json:"error" yaml:"error" mapstructure:"error"`
// Echo of the original Request.id.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Ok corresponds to the JSON schema field "ok".
Ok interface{} `json:"ok" yaml:"ok" mapstructure:"ok"`
// Type corresponds to the JSON schema field "type".
Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}
func (*ResponseErr) UnmarshalJSON ¶
func (j *ResponseErr) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ResponseOk ¶
type ResponseOk struct {
// Method-specific result. Refined by the schema in
// schemas/methods/<method>.schema.json.
Data ResponseOkData `json:"data" yaml:"data" mapstructure:"data"`
// Echo of the original Request.id.
Id string `json:"id" yaml:"id" mapstructure:"id"`
// Ok corresponds to the JSON schema field "ok".
Ok interface{} `json:"ok" yaml:"ok" mapstructure:"ok"`
// Type corresponds to the JSON schema field "type".
Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}
func (*ResponseOk) UnmarshalJSON ¶
func (j *ResponseOk) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ResponseOkData ¶
type ResponseOkData map[string]interface{}
Method-specific result. Refined by the schema in schemas/methods/<method>.schema.json.
type SendKeysActionParams ¶ added in v0.7.0
type SendKeysActionParams struct {
// Key combination to send, e.g. 'Ctrl+Shift+S'.
Keys string `json:"keys" yaml:"keys" mapstructure:"keys"`
}
Params for the built-in 'send_keys' action: types a key combination.
func (*SendKeysActionParams) UnmarshalJSON ¶ added in v0.7.0
func (j *SendKeysActionParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetActiveProfileSchemaJson ¶ added in v0.5.0
type SetActiveProfileSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params SetActiveProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result SetActiveProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Sets which profile is active. The active profile is the one the binding editor reads and writes; switching it swaps the live binding set.
func (*SetActiveProfileSchemaJson) UnmarshalJSON ¶ added in v0.5.0
func (j *SetActiveProfileSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetActiveProfileSchemaJsonParams ¶ added in v0.5.0
type SetActiveProfileSchemaJsonParams struct {
// Identifier of the profile to activate.
Id string `json:"id" yaml:"id" mapstructure:"id"`
}
func (*SetActiveProfileSchemaJsonParams) UnmarshalJSON ¶ added in v0.5.0
func (j *SetActiveProfileSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetActiveProfileSchemaJsonResult ¶ added in v0.5.0
type SetActiveProfileSchemaJsonResult struct {
// Identifier of the now-active profile. Echoes the requested id on success.
ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
}
func (*SetActiveProfileSchemaJsonResult) UnmarshalJSON ¶ added in v0.5.0
func (j *SetActiveProfileSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetAutoSwitchSchemaJson ¶ added in v0.6.0
type SetAutoSwitchSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params SetAutoSwitchSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Result corresponds to the JSON schema field "result".
Result SetAutoSwitchSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Replaces the entire auto-switch configuration in one shot (bulk set, not per-rule CRUD): the master toggle and the full rule set. The result echoes the persisted state. The daemon rejects the whole request with error code PROFILE_NOT_FOUND if any rule's profile_id does not exist; nothing is persisted in that case.
func (*SetAutoSwitchSchemaJson) UnmarshalJSON ¶ added in v0.6.0
func (j *SetAutoSwitchSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetAutoSwitchSchemaJsonParams ¶ added in v0.6.0
type SetAutoSwitchSchemaJsonParams struct {
// Master toggle. When false, the daemon ignores the rules and never
// auto-switches.
Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
// Full replacement set of app-to-profile rules. Any previously stored rules are
// discarded.
Rules []AutoSwitchRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}
func (*SetAutoSwitchSchemaJsonParams) UnmarshalJSON ¶ added in v0.6.0
func (j *SetAutoSwitchSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetAutoSwitchSchemaJsonResult ¶ added in v0.6.0
type SetAutoSwitchSchemaJsonResult struct {
// Master toggle as persisted. Echoes the requested value on success.
Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
// Rules as persisted. Echoes the requested set on success.
Rules []AutoSwitchRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}
func (*SetAutoSwitchSchemaJsonResult) UnmarshalJSON ¶ added in v0.6.0
func (j *SetAutoSwitchSchemaJsonResult) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetBindingSchemaJson ¶
type SetBindingSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params SetBindingSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Empty acknowledgement object. Reserved for future fields (e.g. server-assigned
// binding id) without breaking the schema.
Result SetBindingSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Creates or updates a binding (input -> action) on a device. The pair (device_id, input_id, trigger) is the unique key; calling this method with an existing key replaces the previous action.
func (*SetBindingSchemaJson) UnmarshalJSON ¶
func (j *SetBindingSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetBindingSchemaJsonParams ¶
type SetBindingSchemaJsonParams struct {
// Binding corresponds to the JSON schema field "binding".
Binding Binding `json:"binding" yaml:"binding" mapstructure:"binding"`
}
func (*SetBindingSchemaJsonParams) UnmarshalJSON ¶
func (j *SetBindingSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetBindingSchemaJsonResult ¶
type SetBindingSchemaJsonResult map[string]interface{}
Empty acknowledgement object. Reserved for future fields (e.g. server-assigned binding id) without breaking the schema.
type SetColorActionParams ¶ added in v0.14.0
type SetColorActionParams struct {
// Color corresponds to the JSON schema field "color".
Color Color `json:"color" yaml:"color" mapstructure:"color"`
// DeviceId corresponds to the JSON schema field "device_id".
DeviceId *DeviceID `json:"device_id,omitempty,omitzero" yaml:"device_id,omitempty" mapstructure:"device_id,omitempty"`
// Input to paint. Matches Device.inputs[].id. Absent means the input that fired
// the action; if nothing fired it (e.g. a test run from the GUI), the action
// fails. list_actions advertises it as a ParamSpec of type 'input' with
// input_filter {rgb: true}, which only offers inputs of the device that fired the
// action; when device_id is set, input_id refers to that other device, so clients
// should show it as-is instead of resolving it on the binding's device.
InputId *string `json:"input_id,omitempty,omitzero" yaml:"input_id,omitempty" mapstructure:"input_id,omitempty"`
// false (default): paint only. The active profile's colors are untouched,
// Input.color keeps reporting the profile's color, and the profile's color comes
// back when a profile becomes active or the device reconnects. true: also write
// the color into the active profile, same as set_input_color.
Persist bool `json:"persist,omitempty,omitzero" yaml:"persist,omitempty" mapstructure:"persist,omitempty"`
}
Params for the built-in 'set_color' action: paints the LED of an input. Fails when it runs if the target input is unknown or has no LED (the device may be disconnected when the binding is saved, so the daemon checks it then). device_id is the device of input_id: absent means the device that fired the action, and it is only valid together with input_id (device_id alone is rejected when the binding is saved).
func (*SetColorActionParams) UnmarshalJSON ¶ added in v0.14.0
func (j *SetColorActionParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetDeviceRotationSchemaJson ¶ added in v0.13.0
type SetDeviceRotationSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params SetDeviceRotationSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Empty acknowledgement object.
Result SetDeviceRotationSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Persists how the user has a device rotated on the desk, so clients draw its layout in that orientation. The rotation is stored per device (by device_id), not per profile: switching profiles does not change it. list_devices exposes it in Device.rotation. Presentation only: bindings and colors stay tied to input_id and are not touched. The daemon rejects unknown device_ids; error codes are defined by the daemon.
func (*SetDeviceRotationSchemaJson) UnmarshalJSON ¶ added in v0.13.0
func (j *SetDeviceRotationSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetDeviceRotationSchemaJsonParams ¶ added in v0.13.0
type SetDeviceRotationSchemaJsonParams struct {
// DeviceId corresponds to the JSON schema field "device_id".
DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`
// Rotation corresponds to the JSON schema field "rotation".
Rotation DeviceRotation `json:"rotation" yaml:"rotation" mapstructure:"rotation"`
}
func (*SetDeviceRotationSchemaJsonParams) UnmarshalJSON ¶ added in v0.13.0
func (j *SetDeviceRotationSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetDeviceRotationSchemaJsonResult ¶ added in v0.13.0
type SetDeviceRotationSchemaJsonResult map[string]interface{}
Empty acknowledgement object.
type SetInputColorSchemaJson ¶ added in v0.12.0
type SetInputColorSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params SetInputColorSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Empty acknowledgement object.
Result SetInputColorSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Sets the LED color of an RGB-capable input in the active profile and paints it on the device. The pair (device_id, input_id) is the unique key; calling this method again replaces the previous color, and '#000000' turns the LED off. Colors belong to the profile: switching profiles repaints every RGB input with the new profile's colors. The daemon rejects inputs that are unknown or have no RGB LED (Input.rgb is not true).
func (*SetInputColorSchemaJson) UnmarshalJSON ¶ added in v0.12.0
func (j *SetInputColorSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetInputColorSchemaJsonParams ¶ added in v0.12.0
type SetInputColorSchemaJsonParams struct {
// Color corresponds to the JSON schema field "color".
Color Color `json:"color" yaml:"color" mapstructure:"color"`
// DeviceId corresponds to the JSON schema field "device_id".
DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`
// Logical identifier of the input within the device. Matches Device.inputs[].id.
InputId string `json:"input_id" yaml:"input_id" mapstructure:"input_id"`
}
func (*SetInputColorSchemaJsonParams) UnmarshalJSON ¶ added in v0.12.0
func (j *SetInputColorSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type SetInputColorSchemaJsonResult ¶ added in v0.12.0
type SetInputColorSchemaJsonResult map[string]interface{}
Empty acknowledgement object.
type ToggleActionParams ¶ added in v0.16.0
type ToggleActionParams struct {
// Actions run on the second firing and every other one after it. Must contain at
// least one step.
Off []Action `json:"off" yaml:"off" mapstructure:"off"`
// Actions run on the first firing and every other one after it. Must contain at
// least one step.
On []Action `json:"on" yaml:"on" mapstructure:"on"`
}
Params for the built-in 'toggle' action: alternates between two lists of actions, one per firing. The first firing runs 'on', the next one 'off', then 'on' again, and so on. Each list runs in order like a macro, stopping at the first failure. The state is kept in memory per binding: it starts at 'on' when the daemon starts and when the binding is saved (set_binding), and it is not reset when the active profile changes. The state only advances when every step of the list succeeded, so a failed 'on' is retried on the next firing; a plugin step counts as succeeded once action_invoked is sent, since delivery is fire-and-forget. The schema allows any Action as a step; the daemon rejects steps whose type is 'macro' or 'toggle', and a toggle can't be a macro step either.
func (*ToggleActionParams) UnmarshalJSON ¶ added in v0.16.0
func (j *ToggleActionParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type UninstallPluginSchemaJson ¶ added in v0.11.0
type UninstallPluginSchemaJson struct {
// Params corresponds to the JSON schema field "params".
Params UninstallPluginSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`
// Empty acknowledgement object. Reserved for future fields without breaking the
// schema.
Result UninstallPluginSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}
Stops the plugin's process and deletes its folder. Bindings that use the plugin's actions are left untouched (orphaned): while the plugin is missing, firing them does nothing, and reinstalling the plugin makes them work again.
func (*UninstallPluginSchemaJson) UnmarshalJSON ¶ added in v0.11.0
func (j *UninstallPluginSchemaJson) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type UninstallPluginSchemaJsonParams ¶ added in v0.11.0
type UninstallPluginSchemaJsonParams struct {
// Id of the plugin to uninstall.
Id PluginID `json:"id" yaml:"id" mapstructure:"id"`
}
func (*UninstallPluginSchemaJsonParams) UnmarshalJSON ¶ added in v0.11.0
func (j *UninstallPluginSchemaJsonParams) UnmarshalJSON(value []byte) error
UnmarshalJSON implements json.Unmarshaler.
type UninstallPluginSchemaJsonResult ¶ added in v0.11.0
type UninstallPluginSchemaJsonResult map[string]interface{}
Empty acknowledgement object. Reserved for future fields without breaking the schema.