Files
glassMxrph/quickshell/controlcenter/AudioMixer.qml
T
mxandClaude Opus 5.5 72a21c9363 List app playback streams for per-app volume and drop device lists
Quickshell marks playback streams as sinks, so the mixer showed
recording streams instead of players. Right-clicking Sound now shows
only the app sliders; Microphone no longer extends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 21:40:57 +02:00

110 lines
4.2 KiB
QML
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.
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell.Widgets
import "../components"
import "../services"
import "../theme"
// Extension of the Sound tile: a volume slider per app playback stream (the
// players EasyEffects processes). The app icon mutes it.
ColumnLayout {
id: root
spacing: 2
Demand {
service: AudioService
counter: "streamConsumers"
}
Text {
visible: AudioService.streams.length === 0
text: "No apps are playing audio"
color: Theme.textSecondary
font.pixelSize: 11
Layout.leftMargin: 6
Layout.topMargin: 2
}
Repeater {
model: AudioService.streams
RowLayout {
id: stream
required property var modelData
readonly property bool muted: !!modelData.audio && modelData.audio.muted
readonly property string icon: AudioService.streamIcon(modelData)
objectName: "appVolume-" + AudioService.streamName(modelData)
Layout.fillWidth: true
Layout.preferredHeight: 30
spacing: 8
// The app icon doubles as its mute button.
Item {
implicitWidth: 22
implicitHeight: 22
opacity: stream.muted ? 0.4 : 1
Accessible.role: Accessible.Button
Accessible.name: (stream.muted ? "Unmute " : "Mute ") + AudioService.streamName(stream.modelData)
IconImage {
anchors.fill: parent
visible: stream.icon !== ""
source: stream.icon
asynchronous: true
}
GlassIcon {
anchors.fill: parent
visible: stream.icon === ""
size: 22
glyphSize: 11
fallback: AudioService.streamName(stream.modelData).charAt(0).toUpperCase()
}
Text {
visible: stream.muted
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: -3
text: Icons.available ? "󰖁" : "×"
font.family: Icons.available ? Icons.family : ""
font.pixelSize: 11
color: Theme.text
}
MouseArea {
objectName: "appMute-" + AudioService.streamName(stream.modelData)
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: AudioService.streamMute(stream.modelData)
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: 2
Text {
text: AudioService.streamName(stream.modelData)
color: Theme.text
font.pixelSize: 11
elide: Text.ElideRight
Layout.fillWidth: true
}
GlassBarSlider {
id: level
objectName: "appSlider-" + AudioService.streamName(stream.modelData)
Layout.fillWidth: true
Layout.preferredHeight: 10
from: 0
to: 1
stepSize: 0.01
enabled: !!stream.modelData.audio
value: stream.modelData.audio ? stream.modelData.audio.volume : 0
onMoved: AudioService.streamVolume(stream.modelData, value)
onPressedChanged: if (!pressed)
value = Qt.binding(() => stream.modelData.audio ? stream.modelData.audio.volume : 0)
Accessible.name: AudioService.streamName(stream.modelData) + " volume"
}
}
Text {
text: stream.modelData.audio ? Math.round(stream.modelData.audio.volume * 100) + "%" : "—"
color: Theme.textSecondary
font.pixelSize: 11
horizontalAlignment: Text.AlignRight
Layout.preferredWidth: 32
}
}
}
}