protocol

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func (j *Action) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ActionDescriptor added in v0.3.0

type ActionDescriptor struct {
	// Group the UI lists the action under (e.g. 'Media'). Free text, compared by
	// exact match: a plugin action with the same category as a built-in shares its
	// group. Built-ins use 'System', 'Media', 'Profiles', 'Lighting' and 'Logic';
	// plugins may reuse them. For a plugin action the daemon fills it from
	// PluginManifest.category, or from PluginManifest.name when the manifest has
	// none, so plugin actions always have one. Omitted = uncategorized: the client
	// lists it under an 'Other' group at the end, or, when no action has a category
	// (an older daemon), shows a flat list.
	Category *string `json:"category,omitempty,omitzero" yaml:"category,omitempty" mapstructure:"category,omitempty"`

	// 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, of each list of a toggle and of each branch of an if (at any
	// nesting level), 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 (auto-switch by foreground app, including restoring the base profile when unmatched is 'restore', or a switch_profile, next_profile or previous_profile action). 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 compares it
	// with the frontmost app ignoring case on Windows (where Notepad.exe and
	// notepad.exe name the same file) and exactly on macOS and Linux.
	App string `json:"app" yaml:"app" mapstructure:"app"`

	// Identifier of the profile to activate when this app becomes 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 becomes active when that app becomes frontmost. The daemon applies a rule only when the frontmost app changes (and once at startup for the app frontmost then), not continuously while the app stays in front: a manual switch (set_active_profile, or a switch_profile, next_profile or previous_profile action) holds until the frontmost app changes again. KeyForge itself never counts as the frontmost app: bringing it to the front is not an app change, so editing a profile in KeyForge neither applies a rule nor restores the base, a rule for KeyForge never fires, and at startup with KeyForge in front nothing is applied until another app comes to the front. What happens when the frontmost app matches no rule is set by AutoSwitchUnmatched.

func (*AutoSwitchRule) UnmarshalJSON added in v0.6.0

func (j *AutoSwitchRule) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type AutoSwitchUnmatched added in v0.22.0

type AutoSwitchUnmatched string
const AutoSwitchUnmatchedKeep AutoSwitchUnmatched = "keep"
const AutoSwitchUnmatchedRestore AutoSwitchUnmatched = "restore"

func (*AutoSwitchUnmatched) UnmarshalJSON added in v0.22.0

func (j *AutoSwitchUnmatched) 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

func (j *Binding) UnmarshalJSON(value []byte) error

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

func (j *Color) UnmarshalJSON(value []byte) error

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 DaemonStoppingSchemaJson added in v0.21.0

type DaemonStoppingSchemaJson struct {
	// Data corresponds to the JSON schema field "data".
	Data DaemonStoppingSchemaJsonData `json:"data" yaml:"data" mapstructure:"data"`
}

Pushed by the daemon to every client connection except plugins right before a controlled shutdown, so a client can tell a requested stop from a crash. Best-effort: the daemon sends it before closing the sockets, but a crash or a forced kill sends nothing, so a connection that closes without this event means the daemon went down unexpectedly. Plugins must exit when their connection closes.

func (*DaemonStoppingSchemaJson) UnmarshalJSON added in v0.21.0

func (j *DaemonStoppingSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DaemonStoppingSchemaJsonData added in v0.21.0

type DaemonStoppingSchemaJsonData struct {
	// Why the daemon is stopping. 'user_quit': the user chose to quit KeyForge from
	// the daemon's own UI (the tray's Quit); the GUI should close too. 'terminated':
	// something outside the daemon asked it to stop (a termination signal, the
	// service manager, the OS ending the session or shutting down, or a client
	// stopping or restarting it); the GUI stays open. 'error': the daemon hit a fatal
	// error it could still report before exiting; the GUI stays open.
	Reason DaemonStoppingSchemaJsonDataReason `json:"reason" yaml:"reason" mapstructure:"reason"`
}

func (*DaemonStoppingSchemaJsonData) UnmarshalJSON added in v0.21.0

func (j *DaemonStoppingSchemaJsonData) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DaemonStoppingSchemaJsonDataReason added in v0.21.0

type DaemonStoppingSchemaJsonDataReason string
const DaemonStoppingSchemaJsonDataReasonError DaemonStoppingSchemaJsonDataReason = "error"
const DaemonStoppingSchemaJsonDataReasonTerminated DaemonStoppingSchemaJsonDataReason = "terminated"
const DaemonStoppingSchemaJsonDataReasonUserQuit DaemonStoppingSchemaJsonDataReason = "user_quit"

func (*DaemonStoppingSchemaJsonDataReason) UnmarshalJSON added in v0.21.0

func (j *DaemonStoppingSchemaJsonDataReason) 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. Likewise, every switch_profile action in the remaining profiles that targets the deleted profile is removed: a step of a macro, a toggle or an if is dropped from its list. Then, bottom up: an if whose 'else' became empty loses its 'else'; an if whose 'then' became empty is removed like such a step (from its macro or toggle list, or as the binding's action); and a binding is deleted when its action is removed or when its macro steps, or either side of its toggle, became empty.

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 {
	// Whether the device is present on the HID bus right now. Devices the daemon
	// knows from earlier sessions are still listed while unplugged, with false. It
	// says nothing about whether the daemon may read the device: OS permissions are
	// reported by get_daemon_status. Absent means true, so a client doesn't flag
	// every device as unplugged when talking to a daemon that predates this field;
	// current daemons always send it. Computed per request: it is not part of the
	// persisted device catalog.
	Connected *bool `json:"connected,omitempty,omitzero" yaml:"connected,omitempty" mapstructure:"connected,omitempty"`

	// 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

func (j *Device) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DeviceID

type DeviceID string

Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].

func (*DeviceID) UnmarshalJSON

func (j *DeviceID) UnmarshalJSON(value []byte) error

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 as-is: a switch_profile action keeps its target, so one that targets the source profile still targets the source, not the copy. 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

func (j *Error) UnmarshalJSON(value []byte) error

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

func (j *Event) UnmarshalJSON(value []byte) error

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, the behavior for apps without a rule 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"`

	// Unmatched corresponds to the JSON schema field "unmatched".
	Unmatched AutoSwitchUnmatched `json:"unmatched" yaml:"unmatched" mapstructure:"unmatched"`
}

func (*GetAutoSwitchSchemaJsonResult) UnmarshalJSON added in v0.6.0

func (j *GetAutoSwitchSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetDaemonStatusSchemaJson added in v0.19.0

type GetDaemonStatusSchemaJson struct {
	// No parameters in v1.
	Params GetDaemonStatusSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result GetDaemonStatusSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns runtime facts about the daemon process that the client needs to guide the user, such as whether macOS lets it read input devices or post synthetic keystrokes. Values are read when the request arrives, but macOS settles a process's Input Monitoring access when it starts: a permission granted while the daemon runs is neither reported nor used until the daemon restarts.

func (*GetDaemonStatusSchemaJson) UnmarshalJSON added in v0.19.0

func (j *GetDaemonStatusSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetDaemonStatusSchemaJsonParams added in v0.19.0

type GetDaemonStatusSchemaJsonParams map[string]interface{}

No parameters in v1.

type GetDaemonStatusSchemaJsonResult added in v0.19.0

type GetDaemonStatusSchemaJsonResult struct {
	// macOS Accessibility access of the daemon process, as reported by
	// AXIsProcessTrusted: 'granted' or 'denied'. The daemon needs it to post
	// synthetic keyboard events (send_keys); without it they are dropped silently.
	// Unlike input_monitoring there is no 'unknown': the API cannot tell whether the
	// user was asked. As with input_monitoring, when the executable lives inside an
	// .app bundle macOS checks the enclosing app. Unlike input_monitoring, it is
	// live: granting or revoking the permission while the daemon runs shows up (and
	// takes effect) on the next call, without a restart. Present only on macOS;
	// absent on platforms without this permission.
	Accessibility *GetDaemonStatusSchemaJsonResultAccessibility `json:"accessibility,omitempty,omitzero" yaml:"accessibility,omitempty" mapstructure:"accessibility,omitempty"`

	// Absolute path of the running daemon executable, with symlinks resolved: the
	// process whose access input_monitoring and accessibility report. Clients use it
	// to tell the user which program needs the permission; when the executable lives
	// inside an .app bundle, macOS checks the permission of the enclosing app, so
	// that is what the user must turn on.
	ExecutablePath string `json:"executable_path" yaml:"executable_path" mapstructure:"executable_path"`

	// macOS Input Monitoring access of the daemon process, as reported by
	// IOHIDCheckAccess: 'granted', 'denied', or 'unknown' (the user has not been
	// asked yet). Present only on macOS; absent on platforms without this permission.
	InputMonitoring *GetDaemonStatusSchemaJsonResultInputMonitoring `json:"input_monitoring,omitempty,omitzero" yaml:"input_monitoring,omitempty" mapstructure:"input_monitoring,omitempty"`
}

func (*GetDaemonStatusSchemaJsonResult) UnmarshalJSON added in v0.19.0

func (j *GetDaemonStatusSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetDaemonStatusSchemaJsonResultAccessibility added in v0.23.0

type GetDaemonStatusSchemaJsonResultAccessibility string
const GetDaemonStatusSchemaJsonResultAccessibilityDenied GetDaemonStatusSchemaJsonResultAccessibility = "denied"
const GetDaemonStatusSchemaJsonResultAccessibilityGranted GetDaemonStatusSchemaJsonResultAccessibility = "granted"

func (*GetDaemonStatusSchemaJsonResultAccessibility) UnmarshalJSON added in v0.23.0

func (j *GetDaemonStatusSchemaJsonResultAccessibility) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetDaemonStatusSchemaJsonResultInputMonitoring added in v0.19.0

type GetDaemonStatusSchemaJsonResultInputMonitoring string
const GetDaemonStatusSchemaJsonResultInputMonitoringDenied GetDaemonStatusSchemaJsonResultInputMonitoring = "denied"
const GetDaemonStatusSchemaJsonResultInputMonitoringGranted GetDaemonStatusSchemaJsonResultInputMonitoring = "granted"
const GetDaemonStatusSchemaJsonResultInputMonitoringUnknown GetDaemonStatusSchemaJsonResultInputMonitoring = "unknown"

func (*GetDaemonStatusSchemaJsonResultInputMonitoring) UnmarshalJSON added in v0.19.0

func (j *GetDaemonStatusSchemaJsonResultInputMonitoring) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetFrontmostAppSchemaJson added in v0.24.0

type GetFrontmostAppSchemaJson struct {
	// No parameters in v1.
	Params GetFrontmostAppSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result GetFrontmostAppSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns the frontmost application ignoring KeyForge itself, so a client can offer it when creating an auto-switch rule: while the user clicks a button in KeyForge, KeyForge is the app in front, so the useful answer is the last other app. The daemon keeps that app in memory and tracks it whether or not auto-switch is enabled. It may not be the app the user has in mind (e.g. the file manager KeyForge was opened from), so clients should let the user review it before saving a rule.

func (*GetFrontmostAppSchemaJson) UnmarshalJSON added in v0.24.0

func (j *GetFrontmostAppSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetFrontmostAppSchemaJsonParams added in v0.24.0

type GetFrontmostAppSchemaJsonParams map[string]interface{}

No parameters in v1.

type GetFrontmostAppSchemaJsonResult added in v0.24.0

type GetFrontmostAppSchemaJsonResult struct {
	// OS-native application identifier, in the same format as AutoSwitchRule.app:
	// bundle id on macOS, executable name on Linux/Windows. Absent when the daemon
	// knows no app other than KeyForge, for example right after it started or when
	// frontmost-app detection is unavailable on this system.
	App *string `json:"app,omitempty,omitzero" yaml:"app,omitempty" mapstructure:"app,omitempty"`
}

func (*GetFrontmostAppSchemaJsonResult) UnmarshalJSON added in v0.24.0

func (j *GetFrontmostAppSchemaJsonResult) 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 IfActionParams added in v0.18.0

type IfActionParams struct {
	// Condition corresponds to the JSON schema field "condition".
	Condition VariableCondition `json:"condition" yaml:"condition" mapstructure:"condition"`

	// Actions run when the condition doesn't hold. Absent means nothing runs; when
	// present, must contain at least one step.
	Else []Action `json:"else,omitempty,omitzero" yaml:"else,omitempty" mapstructure:"else,omitempty"`

	// Actions run when the condition holds. Must contain at least one step.
	Then []Action `json:"then" yaml:"then" mapstructure:"then"`
}

Params for the built-in 'if' action: evaluates condition and runs 'then' when it holds, or 'else' (if present) when it doesn't. The chosen list runs in order like a macro, stopping at the first failure, and the 'if' fails when that list fails (so a macro holding it stops, and a toggle holding it doesn't advance). An 'if' may be the binding's action itself, a step of a macro or a step of either toggle list. The schema allows any Action in its lists; the daemon rejects steps whose type is 'macro', 'toggle' or 'if' when the binding is saved. list_actions advertises no ParamSpec for it; clients render a dedicated editor.

func (*IfActionParams) UnmarshalJSON added in v0.18.0

func (j *IfActionParams) 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. Profile ids from another installation are meaningless here, so switch_profile actions in the file whose profile_id matches no existing profile are removed the same way delete_profile removes them (next_profile and previous_profile are kept). 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

func (j *Input) UnmarshalJSON(value []byte) error

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

func (j *InputKind) UnmarshalJSON(value []byte) error

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, file or folder to open, in the native format
	// of the OS the daemon runs on.
	Path string `json:"path" yaml:"path" mapstructure:"path"`
}

Params for the built-in 'launch_app' action: opens an application, file or folder with the OS launcher. Its descriptor announces 'path' as a ParamSpec of type 'path' with path_kind 'app': the picker suggests applications, but any path can be typed, pasted or dropped.

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.
	// The order is meaningful: a client groups actions by ActionDescriptor.category,
	// lists the groups in the order each category first appears here and the actions
	// of a group in list order, with uncategorized actions last.
	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 HID devices known to the daemon, including unplugged ones (see
	// Device.connected).
	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, in creation order: create_profile,
	// duplicate_profile and import_profile append at the end. next_profile and
	// previous_profile follow this order.
	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'. An 'if' step is allowed (see IfActionParams for what its branches may hold).

func (*MacroActionParams) UnmarshalJSON added in v0.7.0

func (j *MacroActionParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type OpenUrlActionParams added in v0.25.0

type OpenUrlActionParams struct {
	// Absolute URL to open. Only 'http' and 'https' are accepted, so a binding cannot
	// open local files or custom URL handlers; keyforge-core also checks it is a
	// well-formed URL when the binding is saved.
	Url string `json:"url" yaml:"url" mapstructure:"url"`
}

Params for the built-in 'open_url' action: opens a web page in the OS default browser. Its descriptor announces 'url' as a ParamSpec of type 'string' with an example URL as placeholder.

func (*OpenUrlActionParams) UnmarshalJSON added in v0.25.0

func (j *OpenUrlActionParams) 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"`

	// PathKind corresponds to the JSON schema field "path_kind".
	PathKind *PathKind `json:"path_kind,omitempty,omitzero" yaml:"path_kind,omitempty" mapstructure:"path_kind,omitempty"`

	// 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. For 'path': example path shown in the text field, for the OS the daemon
	// runs on. Does not apply to 'boolean', 'color' or 'profile'.
	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, 'profile' a string holding a
	// Profile.id, rendered as a picker listing the profiles by name, in list_profiles
	// order. An optional 'profile' that is absent means nothing was picked; each
	// action defines what that means. Only switch_profile is guaranteed never to
	// reference a missing profile (see SwitchProfileActionParams): a plugin receiving
	// a 'profile' param must tolerate an id that no longer exists. 'path' is a string
	// holding an absolute filesystem path in the native format of the OS the daemon
	// runs on (backslashes on Windows; unlike plugin manifest paths, it is not
	// normalized to '/'). A 'path' is rendered as an editable text field (typing and
	// pasting always work) plus a button that opens the native file picker, guided by
	// path_kind, and accepts files dropped onto it where the platform allows. Clients
	// store the path the user picked as is: a Windows shortcut (.lnk) is stored as
	// the .lnk, not resolved to its target. Whether the path exists is checked when
	// the action runs, not when the binding is saved. A client that does not know
	// 'path' should fall back to a plain text field, since the value is a string
	// either way; an older Go consumer instead rejects the unknown enum value and
	// fails to decode the whole list_actions response and any PluginManifest that
	// uses it (accepted because core and desktop ship together). An optional 'path'
	// that is absent means nothing was picked; each action defines what that means.
	// An optional boolean that is absent means false. placeholder only applies to
	// 'string', 'input' and 'path'. '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

func (j *ParamSpec) UnmarshalJSON(value []byte) error

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 ParamSpecTypePath ParamSpecType = "path"
const ParamSpecTypeProfile ParamSpecType = "profile"
const ParamSpecTypeString ParamSpecType = "string"

func (*ParamSpecType) UnmarshalJSON added in v0.3.0

func (j *ParamSpecType) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type PathKind added in v0.20.0

type PathKind string
const PathKindApp PathKind = "app"
const PathKindFile PathKind = "file"
const PathKindFolder PathKind = "folder"

func (*PathKind) UnmarshalJSON added in v0.20.0

func (j *PathKind) 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

func (j *PeerInfo) UnmarshalJSON(value []byte) error

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

func (j *PluginID) UnmarshalJSON(value []byte) error

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').
	// The daemon copies it into ActionDescriptor.category of each of the plugin's
	// actions in list_actions; when omitted, the plugin name is used instead. Reusing
	// a built-in category (e.g. 'Media') groups the plugin's actions with the
	// built-ins.
	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

func (j *Profile) UnmarshalJSON(value []byte) error

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

func (j *Request) UnmarshalJSON(value []byte) error

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 Response

type Response map[string]interface{}

Server -> client. Discriminated by 'ok'.

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 RestartPluginSchemaJson added in v0.24.0

type RestartPluginSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params RestartPluginSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Empty acknowledgement object. Reserved for future fields without breaking the
	// schema.
	Result RestartPluginSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Restarts an installed plugin without restarting the daemon, whatever its status: a stopped or crashed plugin is launched, and a running or starting one is stopped and launched again (a plugin can be connected and still be stuck). Responds right after spawning, without waiting for the plugin's hello; clients read the outcome with list_plugins, where a failure to start shows up as status 'error'. Bindings are left untouched. An id that is not installed is rejected with PLUGIN_NOT_FOUND.

func (*RestartPluginSchemaJson) UnmarshalJSON added in v0.24.0

func (j *RestartPluginSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RestartPluginSchemaJsonParams added in v0.24.0

type RestartPluginSchemaJsonParams struct {
	// Id of the plugin to restart.
	Id PluginID `json:"id" yaml:"id" mapstructure:"id"`
}

func (*RestartPluginSchemaJsonParams) UnmarshalJSON added in v0.24.0

func (j *RestartPluginSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RestartPluginSchemaJsonResult added in v0.24.0

type RestartPluginSchemaJsonResult map[string]interface{}

Empty acknowledgement object. Reserved for future fields without breaking the schema.

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. Activating the profile that is already active changes nothing but repaints its colors, dropping the ones a non-persistent set_color painted. The switch holds until the frontmost app changes and an auto-switch rule matches it (see AutoSwitchRule).

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, the behavior for apps without a rule and the full rule set. An absent unmatched means 'keep', so a request that omits it resets the behavior to 'keep'. 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"`

	// Unmatched corresponds to the JSON schema field "unmatched".
	Unmatched *AutoSwitchUnmatched `json:"unmatched,omitempty,omitzero" yaml:"unmatched,omitempty" mapstructure:"unmatched,omitempty"`
}

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"`

	// Unmatched corresponds to the JSON schema field "unmatched".
	Unmatched AutoSwitchUnmatched `json:"unmatched" yaml:"unmatched" mapstructure:"unmatched"`
}

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. A switch_profile action (directly or as a step of a macro, a toggle or an if) whose profile_id matches no existing profile is rejected with PROFILE_NOT_FOUND and nothing is saved.

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 SetVariableActionParams added in v0.18.0

type SetVariableActionParams struct {
	// Name corresponds to the JSON schema field "name".
	Name VariableName `json:"name" yaml:"name" mapstructure:"name"`

	// 'set' stores value; 'add' adds value to the current one.
	Op SetVariableActionParamsOp `json:"op" yaml:"op" mapstructure:"op"`

	// Value corresponds to the JSON schema field "value".
	Value VariableValue `json:"value" yaml:"value" mapstructure:"value"`

	// Only with 'add': the floored modulo by wrap is taken on the exact sum (it fits
	// in 64 bits, so no clamping applies), which puts the result in 0..wrap-1 and
	// never negative. A current value outside that range (e.g. written by a 'set'
	// elsewhere) is normalized the same way. Cycles modes with a single action: add 1
	// with wrap 3 goes 0, 1, 2, 0, ...
	Wrap *int `json:"wrap,omitempty,omitzero" yaml:"wrap,omitempty" mapstructure:"wrap,omitempty"`
}

Params for the built-in 'set_variable' action: writes a variable (see VariableName). 'set' stores value; 'add' adds value to the current one (a negative value subtracts). Without wrap, a result past the VariableValue bounds is clamped to the bound. wrap is only valid with 'add' (the daemon rejects it with 'set' when the binding is saved). list_actions advertises no ParamSpec for it; clients render a dedicated editor.

func (*SetVariableActionParams) UnmarshalJSON added in v0.18.0

func (j *SetVariableActionParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetVariableActionParamsOp added in v0.18.0

type SetVariableActionParamsOp string
const SetVariableActionParamsOpAdd SetVariableActionParamsOp = "add"
const SetVariableActionParamsOpSet SetVariableActionParamsOp = "set"

func (*SetVariableActionParamsOp) UnmarshalJSON added in v0.18.0

func (j *SetVariableActionParamsOp) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SwitchProfileActionParams added in v0.17.0

type SwitchProfileActionParams struct {
	// Identifier of the profile to activate. list_actions advertises it as a
	// ParamSpec of type 'profile'.
	ProfileId string `json:"profile_id" yaml:"profile_id" mapstructure:"profile_id"`
}

Params for the built-in 'switch_profile' action: makes the given profile active like set_active_profile does (its colors are painted); unlike that request, the daemon pushes active_profile_changed, since no client asked for the switch. Switching to the already active profile does nothing. The sibling built-ins 'next_profile' and 'previous_profile' take no params: they activate the profile after or before the active one in list_profiles order (creation order), wrapping around at either end, and do nothing when there is a single profile. These actions never leave a reference to a missing profile: set_binding rejects an unknown profile_id with PROFILE_NOT_FOUND, and delete_profile and import_profile remove the references they would leave dangling.

func (*SwitchProfileActionParams) UnmarshalJSON added in v0.17.0

func (j *SwitchProfileActionParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

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. An 'if' step is allowed (see IfActionParams for what its branches may hold).

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.

type VariableCondition added in v0.18.0

type VariableCondition struct {
	// Comparison: equal, not equal, less than, less or equal, greater than, greater
	// or equal.
	Op VariableConditionOp `json:"op" yaml:"op" mapstructure:"op"`

	// Value corresponds to the JSON schema field "value".
	Value VariableValue `json:"value" yaml:"value" mapstructure:"value"`

	// Variable corresponds to the JSON schema field "variable".
	Variable VariableName `json:"variable" yaml:"variable" mapstructure:"variable"`
}

Compares a variable against a constant: true when '<variable> <op> <value>' holds. A variable never written compares as 0.

func (*VariableCondition) UnmarshalJSON added in v0.18.0

func (j *VariableCondition) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type VariableConditionOp added in v0.18.0

type VariableConditionOp string
const VariableConditionOpEq VariableConditionOp = "eq"
const VariableConditionOpGe VariableConditionOp = "ge"
const VariableConditionOpGt VariableConditionOp = "gt"
const VariableConditionOpLe VariableConditionOp = "le"
const VariableConditionOpLt VariableConditionOp = "lt"
const VariableConditionOpNe VariableConditionOp = "ne"

func (*VariableConditionOp) UnmarshalJSON added in v0.18.0

func (j *VariableConditionOp) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type VariableName added in v0.18.0

type VariableName string

Name of a variable used by the 'set_variable' and 'if' built-ins. Variables are daemon-wide (shared by every profile and binding), hold an integer and live in memory only: every variable is 0 until written and they all start over at 0 when the daemon restarts. Each set_variable is applied atomically, so bindings firing at the same time never lose an update; an if reads the variable when it runs, so it sees writes made by earlier steps of the same macro. Plugins can't read or write them.

func (*VariableName) UnmarshalJSON added in v0.18.0

func (j *VariableName) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type VariableValue added in v0.18.0

type VariableValue int

Integer value of a variable, or an operand compared or combined with one. Bounded to the range a JSON number keeps exact in JavaScript (Number.MAX_SAFE_INTEGER).

func (*VariableValue) UnmarshalJSON added in v0.18.0

func (j *VariableValue) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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