From f97e7f7fe99428fdd38edeec58e2a1c6ed6b2e52 Mon Sep 17 00:00:00 2001 From: bbedward Date: Wed, 23 Sep 2026 11:41:35 -0400 Subject: [PATCH] audio: drop input ports and hidden sinks from switchable outputs --- quickshell/Services/AudioService.qml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/quickshell/Services/AudioService.qml b/quickshell/Services/AudioService.qml index f073ecb57..d03e09e97 100644 --- a/quickshell/Services/AudioService.qml +++ b/quickshell/Services/AudioService.qml @@ -49,7 +49,7 @@ Singleton { property var sinkPorts: ({}) property var cards: [] property var pendingCardSwitch: null - readonly property var switchableOutputPorts: root.collectSwitchableOutputPorts(root.cards) + readonly property var switchableOutputPorts: root.collectSwitchableOutputPorts(root.cards, SessionData.hiddenOutputDeviceNames ?? []) readonly property int sinkMaxVolume: { const name = sink?.name ?? ""; @@ -409,7 +409,14 @@ Singleton { return candidates[0]; } - function collectSwitchableOutputPorts(cards) { + function profileSinkNames(cardName, profile) { + if (!cardName.startsWith("alsa_card.")) + return []; + const prefix = "alsa_output." + cardName.substring(10) + "."; + return profile.split("+").filter(part => part.startsWith("output:")).map(part => prefix + part.substring(7)); + } + + function collectSwitchableOutputPorts(cards, hiddenSinkNames) { const entries = []; for (const card of cards || []) { if (!card.activeProfile || card.activeProfile === "pro-audio") @@ -417,9 +424,13 @@ Singleton { for (const port of card.ports) { if (port.availability === "no" || port.profiles.includes(card.activeProfile)) continue; + if (port.profiles.some(name => name.startsWith("input:"))) + continue; const profile = bestOutputProfile(card, port); if (!profile) continue; + if (profileSinkNames(card.name, profile).some(name => hiddenSinkNames.includes(name))) + continue; const product = port.props["device.product.name"] || ""; entries.push({ cardName: card.name,