Review fixes: tolerate a vanished default sink, recover stale virtual displays

- virtual_audio: when the previous default output no longer exists, still
  unload the null sink instead of keeping all output on it.
- uu-virtual-desktop: a socket/lock left by a dead Xvfb no longer blocks the
  service forever (Restart=always loop); a live owner is still refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
VallierDevandClaude Opus 5.5 committed 2026-10-15 11:03:42 +08:00
1 parent 0da79a45eb
commit 9125e51350
2 files changed
+14 -2

No files matched your search

+5 -1
View File
@@ -49,7 +49,11 @@ fn persist(route: &Route) -> Result<(), ()> {
}
fn recover(route: &Route) -> Result<(), ()> {
// Do not overwrite a default explicitly changed by the user during remote control.
if pactl(&["get-default-sink"])? == SINK { pactl(&["set-default-sink",&route.previous])?; }
// The previous output may be gone (unplugged USB card): still unload our sink so the server
// picks another default instead of leaving every stream on a null sink.
if pactl(&["get-default-sink"]).is_ok_and(|s| s == SINK) && pactl(&["set-default-sink",&route.previous]).is_err() {
log::warn!("Previous default audio output unavailable; the sound server will choose a new default");
}
move_inputs(SINK,&route.previous);
let modules=owned_modules(&pactl(&["list","short","modules"])?);
for id in modules { pactl(&["unload-module",&id.to_string()])?; }