Commit Graph
2 Commits
Author SHA1 Message Date
brad bf6595614a Fix KDE shortcuts never binding, and add a joystick widget
The shortcuts wrote the Plasma 5 value format and so never bound anything,
which is what produced "No default shortcuts" in System Settings.

kglobalacceld's KServiceActionComponent::loadSettings reads the services
_launch key as a bare key sequence and hands it straight to
QKeySequence::fromString. Plasma 5 stored a "keys,default,name" triplet
there and Plasma 6 does not, so "Meta+Alt+T,none,Insta360: Toggle AI
tracking" parsed to an empty sequence and bound no key. The value is now
just the key sequence; alternates would be tab-separated and "none" means
unbound.

Two supporting changes. The desktop entries now carry X-KDE-Shortcuts,
which is where kglobalacceld reads an entry's default shortcut from, so the
binding shows up in System Settings as a default instead of as nothing.
And they are no longer NoDisplay by default: KApplicationTrader skips
NoDisplay services, so hiding them from the launcher also hid them from the
Shortcuts page, which is the opposite of helpful. HIDE_FROM_MENU=1 restores
the old behaviour.

--list is now a diagnostic rather than a bare dump: it reports the
registered key, the default from the desktop entry, whether the entry file
exists, and flags any comma-bearing value as the unparseable Plasma 5 form.
It would have identified this fault directly.

The new plasmoid is a Plasma 6 applet: a velocity-style virtual joystick
plus zoom slider and Home/Center/Tracking buttons. It drives the gimbal
with relative moves, not absolute ones, because linkctl status reports no
pan or tilt while the camera is idle, leaving no trustworthy position to aim
from; relative steps work in either state and cannot drift, and linkctl
clamps them to the device range. The pure logic lives in a .js library so it
is testable outside Plasma.

Tested: 36 new node checks over shell quoting, tick command construction,
inversion, the per-axis threshold and the multi-object JSON merge, each
confirmed meaningful by mutation. Reproduced the broken shortcut state in a
throwaway HOME and verified --list flags it and reinstalling repairs it. All
QML passes qmllint with no syntax errors (KDE modules are unresolvable
offline). shellcheck clean. The applet has not been loaded in a real Plasma
session.
2026-10-07 21:03:38 -07:00
brad f7e42f7132 Add OBS and KDE hotkey integration for linkctl
Wraps linkctl so the Insta360 Link 2's AI tracking and gimbal presets are
reachable from a keypress and from OBS, instead of a terminal.

bin/linkctl-macro resolves the linkctl binary itself, because a desktop
shortcut is launched with a far sparser PATH than an interactive shell and
would otherwise just fail silently. It defaults to --force on the grounds
that a deliberate keypress means "act now" even when nothing holds the
camera open, which is precisely the state the Link parks itself in. Results
go to a desktop notification, since tracking state and gimbal position are
invisible otherwise, and linkctl's documented exit codes are mapped to
actionable text.

kde/install-shortcuts.sh registers Plasma global shortcuts via .desktop
entries plus kglobalshortcutsrc. These work under Wayland, where OBS's own
hotkeys only fire while OBS has focus. It writes with the shortcut daemon
stopped, because the daemon rewrites that file on exit and would discard the
entries. Supports --dry-run, --list and --uninstall.

obs/obs-linkctl.lua adds OBS hotkeys, test buttons, and scene-to-action
mapping, so switching scenes can set the camera state unattended. Its
startup action defaults to loading the home preset, which undoes the
gimbal's idle parking when OBS launches. Commands are backgrounded so the
OBS UI thread never waits on the camera, and identical commands within
250ms are collapsed to absorb the repeated events studio mode emits.

Tested: 22 offline Lua checks over shell quoting, action tokenizing, scene
map parsing and command construction; the wrapper exercised against a stub
linkctl for every documented exit code; the KDE installer dry-run, install,
list and uninstall paths run against stubbed Plasma tools in a throwaway
HOME. shellcheck clean. Not yet run against a live camera or a real Plasma
session.
2026-10-07 09:46:15 -07:00