Ask for the headset profile at capture start; relaunch the daemon on update

The daemon now requests the Bluetooth headset profile itself (pactl
set-card-profile) the moment a take starts, instead of waiting for
WirePlumber to notice the stream and run its switch timer. The microphone
link comes up 0.15-0.18 s after the key instead of 0.21-0.27 s; WirePlumber
still restores A2DP when the stream goes away. First real audio is now at
0.82-0.86 s, which is the headset's own floor.

When the plugin is updated while the daemon runs, the daemon sees its source
change, exits with code 4 once idle, and the shell service relaunches it
without counting that as a crash.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xoc9DJCViR7dg9eKzzAcfQ
This commit is contained in:
2026-09-09 12:17:06 +01:00
parent 6f7f7ddd6c
commit b93327dc26
3 changed files with 69 additions and 21 deletions
+5
View File
@@ -105,6 +105,11 @@ Item {
}
onExited: function(code, status) {
root.state = ({})
if (code === 4) { // the daemon saw its own source change (plugin update) and asked to be relaunched
restartTimer.interval = 500
restartTimer.restart()
return
}
root.restarts += 1
if (code !== 3 && root.restarts >= 3) root.daemonError = "daemon keeps exiting (code " + code + ") — check the log"
restartTimer.interval = code === 3 ? 5000 : Math.min(10000, 1000 + root.restarts * 1000) // 3 = another instance holds the lock