Repository navigation
fix(audio): volume keys move the default sink instead of the active call stream - #14806
dmedina13-fl wants to merge 1 commit into
Conversation
Linux routes the volume keys to the default sink, so during a call the headset is a separate, non-default sink and the keys (and a headset volume knob sending the same XF86 events) move the laptop speakers instead of the call. Teach omarchy-audio-output-sink an --active mode that resolves the sink an uncorked stream is playing into when that is not the default sink, preferring a communication stream (media.role phone/communication). omarchy-audio-output-volume gains --follow-active, and every volume-key path (the ALT precise bindings, the helpers fallback, and the shell's runShortcut fallback) passes it. The shell's in-process fast path now defers to the script when the active sink differs from the default, resolved through omarchy-audio-output-sink --active, so the common default-sink case still steps the volume without spawning a process.
|
| if (activeSinkName && activeSinkName !== String(defaultSink.name)) return false | ||
|
|
||
| refreshActiveSink() |
There was a problem hiding this comment.
When a headset call starts between polls, activeSinkName still names the default output. handleVolumeKey checks that old value, starts a refresh, then changes the speakers before the result arrives. It returns true, so the script never handles that press. Resolve the output before applying the action, or defer to the script while the cached answer may be stale.
| name="$(pactl -f json list sinks 2>/dev/null | | ||
| jq -r --argjson i "$idx" '.[] | select(.index == $i) | .name' 2>/dev/null)" | ||
| [[ -n $name ]] || continue | ||
| [[ $name == "$default_sink" ]] && continue |
There was a problem hiding this comment.
A call on the default output loses to background music on another output. The resolver puts the call first, but this unconditional continue discards it because it uses the default output. The loop then returns the music output, so volume and mute keys control music rather than the call. Keep the preferred call output even when it is the default, and add this mixed-output case to the tests.
|
Superseded by #14813 — reopened under the correct account (b2amedina). |
1 similar comment
|
Superseded by #14813 — reopened under the correct account (b2amedina). |
Problem
During a call, the volume keys and a headset volume knob (which sends the same
XF86Audio*events) control the laptop's default sink instead of the call. The headset is a separate, non-default sink, so pressing volume up raises the speakers while the call is playing into the headset.What
The volume keys follow the stream that is actually playing, instead of always the default sink.
Why
Linux routes the volume keys to the default sink, and PipeWire keeps the call on its own sink, so the keys act on the wrong device for the entire call. This makes them act on the currently playing stream, matching what users expect mid-call.
How
omarchy-audio-output-sink --activeresolves the sink an uncorked stream is playing into when that is not the default sink, preferring a communication stream (media.rolephone/communication, PipeWire's canonical VOIP role) so a meeting outranks background playback when several streams play at once. Falls back to the default sink otherwise.omarchy-audio-output-volume --follow-activesteps that sink instead of the default.ALT + XF86Audio*precise bindings, the{ audio = ... }helpers fallback, and the shell'srunShortcutfallback.omarchy.mediahandleVolumeKey) now defers to the script when the active sink differs from the default. The shell cannot see which sink a stream is linked to, so the active sink is resolved in a process (omarchy-audio-output-sink --active), refreshed on default-sink change, on a 5s timer, and on each press. The common case — nothing playing on a second output — still steps the default sink in-process with no process spawned.Testing
test/shell.d/audio-output-active-test.shcovers the resolver: idle → default, uncorked stream wins, default/monitor/corked skipped, call outranks music, explicit sink-name overrides--active.test/shell.d/media-test.sh(shell deferral +--follow-activefallback) andtest/shell.d/shell-shortcuts-test.sh(fallback command)../test/clipasses (metadata lint for the two changed bin commands).Related work
omarchy-audio-output-volumeargument handling; worth sequencing so this flag does not collide.Model.js.The shell deferral is a deliberate middle ground: it keeps the zero-process fast path introduced in #13424 for the default-sink case, and only spends a resolver process when a non-default stream is active (or to keep the resolution fresh).