Skip to content

Scripting with D Bus

LordBooker edited this page Oct 29, 2026 · 4 revisions

Scripting with D-Bus

The daemon offers a D-Bus API on the session bus. A call starts the daemon on demand.

  • Service io.github.lordbooker.GKeyConfig
  • Object /io/github/lordbooker/GKeyConfig
  • Interface io.github.lordbooker.GKeyConfig1
DEST="io.github.lordbooker.GKeyConfig /io/github/lordbooker/GKeyConfig io.github.lordbooker.GKeyConfig1"
busctl --user call $DEST Status                    # state as JSON
busctl --user call $DEST SetProfile ss g13 Gaming  # switch profile
busctl --user call $DEST SetMode si g13 2          # switch to layer M2
busctl --user call $DEST LcdText si "Build done" 5 # text on the LCD for 5 seconds
busctl --user call $DEST RunMacro s hello          # run a macro

Model IDs: g13, g510, g15, g15v2, g11.

Methods

Method Effect
Status() → s state as JSON: version, devices, profiles, active profile and layer, macros
SetProfile(s model, s name) → b activate a profile
SetMode(s model, i mode) → b switch layer 1–3
SetBacklight(s model, i r, i g, i b) → b temporary colour (RGB devices) until the next profile change
ResetBacklight(s model) → b back to the profile's backlight
Reload() re-read profiles and macros (normally automatic)
RunMacro(s name) → b, StopMacros() run a macro, stop all running macros
SetRecording(b) MR LED and recording state
LcdText(s text, i seconds) text page, lines separated by newline characters; seconds 0 = until the page is changed
LcdPage(s page) next, previous, status, system, cpu, amdgpu, nvidia, clock, text, profile, intro (plays the start animation)
CalibrateStick(s model) → b G13: the current stick position becomes the rest position

Signals

DeviceAdded(s model, s syspath), DeviceRemoved(s model, s syspath), ProfileChanged(s model, s name), ModeChanged(s model, i mode), KeyEvent(s model, s key, b pressed), RecordingChanged(b).

busctl --user monitor io.github.lordbooker.GKeyConfig

Clone this wiki locally