feat(audio): prefer dock/HDMI/USB sinks in WirePlumber (#87)
Some checks failed
Check / eval (push) Has been cancelled
Some checks failed
Check / eval (push) Has been cancelled
Raise priority.session for HDMI/DisplayPort (1100) and USB (1050) ALSA outputs so the default sink follows dock plug/unplug; built-in analog wins again when externals disappear. Rules live in modules/nixos/dock-audio-rules.nix; checks.dock-audio covers the contract. Verified: V2 — flake check --no-build; checks.dock-audio green. V3 pending: HARDWARE-QUEUE #87 real HDMI/USB-dock hotplug.
This commit is contained in:
@@ -125,6 +125,10 @@ in
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
wireplumber.enable = true;
|
||||
# Prefer dock/HDMI/USB sinks when present; fall back to built-in when
|
||||
# they disappear (BACKLOG #87). Rules: ./dock-audio-rules.nix.
|
||||
wireplumber.extraConfig."90-nomarchy-dock-audio" =
|
||||
import ./dock-audio-rules.nix;
|
||||
};
|
||||
|
||||
# ── Desktop services ─────────────────────────────────────────────
|
||||
|
||||
38
modules/nixos/dock-audio-rules.nix
Normal file
38
modules/nixos/dock-audio-rules.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
# WirePlumber 0.5 ALSA rules: prefer dock / external sinks over built-in
|
||||
# analog when they appear (BACKLOG #87). Higher priority.session wins as
|
||||
# the default node; when HDMI/USB goes away, the next-highest (usually
|
||||
# the laptop speakers/headphones) becomes default again.
|
||||
#
|
||||
# Pure attrset so checks.dock-audio can unit-test the contract without a
|
||||
# full PipeWire stack. Consumed by modules/nixos/default.nix.
|
||||
#
|
||||
# Priorities stay ≤1500 (WirePlumber docs: sinks default ~600–1000; going
|
||||
# much higher can outrank streams / BT in surprising ways).
|
||||
{
|
||||
"monitor.alsa.rules" = [
|
||||
{
|
||||
# HDMI / DisplayPort monitor audio (names vary: .hdmi-stereo,
|
||||
# .hdmi-surround, HiFi__HDMI1__sink, …).
|
||||
matches = [
|
||||
{ "node.name" = "~alsa_output\\..*\\.hdmi-.*"; }
|
||||
{ "node.name" = "~alsa_output\\..*HDMI.*"; }
|
||||
{ "node.name" = "~alsa_output\\..*\\.DisplayPort.*"; }
|
||||
{ "node.name" = "~alsa_output\\..*\\.dp-.*"; }
|
||||
];
|
||||
actions."update-props" = {
|
||||
"priority.driver" = 1100;
|
||||
"priority.session" = 1100;
|
||||
};
|
||||
}
|
||||
{
|
||||
# USB dock / dongle audio (Thunderbolt dock, USB-C audio, …).
|
||||
matches = [
|
||||
{ "node.name" = "~alsa_output\\.usb-.*"; }
|
||||
];
|
||||
actions."update-props" = {
|
||||
"priority.driver" = 1050;
|
||||
"priority.session" = 1050;
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user