Files
Nomarchy/modules/nixos/dock-audio-rules.nix
Bernardo Magri f47903a6a6
Some checks failed
Check / eval (push) Has been cancelled
feat(audio): prefer dock/HDMI/USB sinks in WirePlumber (#87)
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.
2026-07-11 10:36:07 +01:00

39 lines
1.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 ~6001000; 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;
};
}
];
}