Add set-default action #8
No reviewers
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/nanoKontroller2!8
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-2-set-default"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a
set-defaultaction that makes itstargetnode the PipeWire default sink or source, plus the listener-unregister fix it builds on.fix(audio):UnregisterNodeListener/UnregisterLinkListenerlooped withItr != val.rbegin(), so they never removed anything. Replaced withstd::erase.feat(actions):AudioServicenow also holdsdefault-nodes-api, exposingSetDefaultNode/IsDefaultNodeand aDefaultNodeListenersfan-out driven by the plugin'schangedsignal.Action_SetDefaultis set-only (second press is a no-op), derives sink vs. source from the node'smedia.class(prefix match,*/Internalrejected), and writes its LED only from the reported active default, so it also trackswpctl/GUI changes. README documents the new action type.Two deviations from the plan:
SPA_ID_INVALIDis spelledG_MAXUINT32(the plan's stated fallback). The build only getswireplumber-0.5's include dirs — the existing code already has to spell PipeWire headers aspipewire-0.3/pipewire/keys.h— so<spa/utils/defs.h>is not reliably on the include path. Upstream treats the two as equal (wpctl.c: "currently SPA_ID_INVALID == G_MAXUINT32").Init, the branch wheredefault-nodes-apiis already present also delivers the initial state, and disconnects a previous handler before connecting:Initruns again after a WirePlumber reconnect and would otherwise stack handlers on the same plugin instance.Verification
No WirePlumber/GLib/PipeWire development headers are available in this session (no root, no package manager), and this Forgejo instance has no Actions runner, so neither a real build nor the behavioural steps from the issue could be run here. What was checked instead:
modules/module-default-nodes-api.cdeclaresget-default-node(G_TYPE_UINT (const gchar* media_class), returningSPA_ID_INVALIDwhen unset),set-default-configured-node-name(G_TYPE_BOOLEAN (const gchar*, const gchar*)) and a zero-argumentchangedsignal that is emitted only for the active default keys (default.audio.sink/default.audio.source), not the configured ones — which is exactly the LED semantics the issue asks for.src/tools/wpctl.cloads the module the same way this code does (wp_core_load_component(..., "module", ...), no explicit activation).g++ -std=c++2c -fsyntax-onlyagainst a throwaway stub of the GLib/WirePlumber surface (discarded afterwards, not committed). That covers C++ syntax, the new virtual override signatures and thestd::eraserewrite — it does not cover the real headers.The behavioural checklist from the issue (steps 1–7) still needs a machine with PipeWire and the device.
Closes: #2
WIP: Add set-default actionto Add set-default actionRebase please, that should trigger CI
903fad3f10to9268e56ba1Rebased onto
main(now659be1e, no overlapping files) and force-pushed: head is9268e56.CI did trigger and both checks are green —
Build / build (push)andBuild / build (pull_request). So the compile against WirePlumber 0.5.14 is confirmed, including theG_MAXUINT32spelling forSPA_ID_INVALID.Still untested here: the behavioural steps 1–7 from #2, which need a running PipeWire session and the device.