Fix virtual mic routing: WirePlumber was restoring the stream to the speakers

WirePlumber's node.stream.restore-target remembers where each stream last
played and restores it, ignoring the default sink, so vois.rs output kept
going to the headphones. setup() now installs a wireplumber.conf.d override
(restore-target/props = false) and restarts WirePlumber on first use.
Also: virtual mic setup runs before any device queries, and keep_others_off
pulls our own stream back onto vois.rs if it drifts.
This commit is contained in:
loki5512344 2026-08-02 18:52:05 +02:00
parent aacaf7d9cf
commit 7e8972e716
4 changed files with 142 additions and 22 deletions

View file

@ -8,6 +8,27 @@ SINK_NAME="vois.rs"
SINK_DESC="vois.rs virtual mic"
REMAP_NAME="vois.rs"
CONF_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/wireplumber/wireplumber.conf.d"
CONF_FILE="${CONF_DIR}/51-vois.conf"
# WirePlumber remembers stream targets and restores them, so streams that once
# played to the speakers keep going there even after the default sink changes.
# Disable that so the app's output follows the default (vois.rs).
if [ ! -f "${CONF_FILE}" ] || ! grep -q "restore-target = false" "${CONF_FILE}" 2>/dev/null; then
mkdir -p "${CONF_DIR}"
cat > "${CONF_FILE}" <<EOF
wireplumber.settings = {
node.stream.restore-target = false
node.stream.restore-props = false
}
EOF
echo "installed WirePlumber fix (${CONF_FILE})"
systemctl --user restart wireplumber || true
echo "restarted WirePlumber"
else
echo "WirePlumber fix already present"
fi
# Idempotency check: field 2 of `pactl list short <x>` is the object name.
if ! pactl list short sinks | awk -v n="${SINK_NAME}" '$2==n' | grep -q .; then
pactl load-module module-null-sink \