From 72a21c9363fce5ff3c32f277b1a1b0552f8b1cb0 Mon Sep 17 00:00:00 2001 From: mx Date: Sat, 17 Oct 2026 21:40:57 +0200 Subject: [PATCH] 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 --- README.md | 4 +- quickshell/controlcenter/AudioMixer.qml | 71 ++------------------- quickshell/controlcenter/modules/Input.qml | 5 +- quickshell/controlcenter/modules/Output.qml | 2 +- quickshell/services/AudioService.qml | 5 +- quickshell/testing/ControlDriver.qml | 18 +++++- tests/controlcenter_runtime.py | 1 + 7 files changed, 29 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index e858701..abe9c07 100644 --- a/README.md +++ b/README.md @@ -182,8 +182,8 @@ power profile, Now Playing, power actions and system metrics, with Notifications below. Each tile can be any size from 1×1 to 4×4 and adapts its layout to it. **Edit Controls** at the bottom of the panel lets you drag tiles to reorder them, resize them from the corner handle, remove them with the badge and add others. -Right-click Sound to extend it with output devices and a volume slider per app -(the players EasyEffects processes); right-click a toggle to open its settings. +Right-click Sound to extend it with a volume slider per app (the players +EasyEffects processes); right-click a toggle to open its settings. Logout, reboot and shutdown require explicit confirmation. NetworkManager, BlueZ and PipeWire use native Quickshell models. Other controls reuse diff --git a/quickshell/controlcenter/AudioMixer.qml b/quickshell/controlcenter/AudioMixer.qml index 9fcaebb..5568294 100644 --- a/quickshell/controlcenter/AudioMixer.qml +++ b/quickshell/controlcenter/AudioMixer.qml @@ -6,86 +6,25 @@ import "../components" import "../services" import "../theme" -// Extension of the Output and Input tiles: device choice, and for output a -// volume slider per app stream (the players EasyEffects processes). +// Extension of the Sound tile: a volume slider per app playback stream (the +// players EasyEffects processes). The app icon mutes it. ColumnLayout { id: root - property bool input: false - readonly property var nodes: input ? AudioService.inputs : AudioService.outputs - readonly property var current: input ? AudioService.source : AudioService.sink spacing: 2 Demand { service: AudioService counter: "streamConsumers" - active: !root.input - } - component Heading: Text { - color: Theme.textSecondary - font.pixelSize: 10 - font.weight: Font.DemiBold - font.letterSpacing: 1.1 - Layout.topMargin: 4 - Layout.bottomMargin: 2 - } - - Heading { - text: root.input ? "INPUT DEVICE" : "OUTPUT DEVICE" - } - Repeater { - model: root.nodes - Rectangle { - id: device - required property var modelData - required property int index - readonly property bool selected: modelData === root.current - Layout.fillWidth: true - implicitHeight: 28 - radius: 8 - color: deviceArea.containsMouse ? Qt.alpha(Theme.text, 0.08) : Theme.transparent - RowLayout { - anchors.fill: parent - anchors.leftMargin: 6 - anchors.rightMargin: 6 - spacing: 8 - Text { - text: device.selected ? "✓" : "" - color: Theme.accent - font.pixelSize: 12 - Layout.preferredWidth: 12 - } - Text { - text: device.modelData.description || device.modelData.name - color: device.selected ? Theme.text : Qt.alpha(Theme.text, 0.8) - font.pixelSize: 12 - font.weight: device.selected ? Font.DemiBold : Font.Normal - elide: Text.ElideRight - Layout.fillWidth: true - } - } - MouseArea { - id: deviceArea - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: AudioService.select(root.input, device.index) - } - } - } - - Heading { - visible: !root.input - text: "APPLICATIONS" - Layout.topMargin: 8 } Text { - visible: !root.input && AudioService.streams.length === 0 + 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: root.input ? [] : AudioService.streams + model: AudioService.streams RowLayout { id: stream required property var modelData diff --git a/quickshell/controlcenter/modules/Input.qml b/quickshell/controlcenter/modules/Input.qml index c6ff68d..8d56746 100644 --- a/quickshell/controlcenter/modules/Input.qml +++ b/quickshell/controlcenter/modules/Input.qml @@ -3,7 +3,7 @@ import QtQuick import ".." import "../../services" -// Microphone level. Right click (or spare rows) shows input devices. +// Microphone level. CCSlider { readonly property var node: AudioService.source objectName: "inputTile" @@ -20,7 +20,4 @@ CCSlider { notice: AudioService.available ? "" : "PipeWire is unavailable" onMoved: value => AudioService.volume(true, value) onMuteClicked: AudioService.mute(true) - extension: AudioMixer { - input: true - } } diff --git a/quickshell/controlcenter/modules/Output.qml b/quickshell/controlcenter/modules/Output.qml index 9f0f6be..54e7588 100644 --- a/quickshell/controlcenter/modules/Output.qml +++ b/quickshell/controlcenter/modules/Output.qml @@ -3,7 +3,7 @@ import QtQuick import ".." import "../../services" -// Output volume. Right click (or spare rows) shows devices and per-app volume. +// Output volume. Right click (or spare rows) shows per-app volume. CCSlider { readonly property var node: AudioService.sink objectName: "outputTile" diff --git a/quickshell/services/AudioService.qml b/quickshell/services/AudioService.qml index de5a474..fb54ccf 100644 --- a/quickshell/services/AudioService.qml +++ b/quickshell/services/AudioService.qml @@ -10,8 +10,9 @@ Singleton { readonly property var source: backend.defaultAudioSource readonly property var outputs: backend.nodes.values.filter(n => n.audio && n.isSink && !n.isStream) readonly property var inputs: backend.nodes.values.filter(n => n.audio && !n.isSink && !n.isStream) - // App playback streams, e.g. the players EasyEffects processes. - readonly property var streams: backend.nodes.values.filter(n => n.audio && n.isStream && !n.isSink) + // App playback streams, e.g. the players EasyEffects processes. Quickshell + // marks playback streams (Stream/Output/Audio) as sinks. + readonly property var streams: backend.nodes.values.filter(n => n.audio && n.isStream && n.isSink) readonly property bool available: backend.ready // Views listing streams hold a Demand on this, so their volumes are only // tracked while shown. diff --git a/quickshell/testing/ControlDriver.qml b/quickshell/testing/ControlDriver.qml index 49b11c6..3bea956 100644 --- a/quickshell/testing/ControlDriver.qml +++ b/quickshell/testing/ControlDriver.qml @@ -38,7 +38,7 @@ Item { property var streamNode: QtObject { property string name: "fixture-player" property string description: "" - property bool isSink: false + property bool isSink: true property bool isStream: true property var properties: ({ "application.name": "Fixture player" @@ -48,6 +48,19 @@ Item { property bool muted: false } } + property var recordingNode: QtObject { + property string name: "fixture-recorder" + property string description: "" + property bool isSink: false + property bool isStream: true + property var properties: ({ + "application.name": "Fixture recorder" + }) + property QtObject audio: QtObject { + property real volume: 1 + property bool muted: false + } + } property QtObject audioBackend: QtObject { property bool ready: true property var defaultAudioSink: root.audioNode @@ -55,7 +68,7 @@ Item { property var preferredDefaultAudioSink: root.audioNode property var preferredDefaultAudioSource: root.audioInput property QtObject nodes: QtObject { - property var values: [root.audioNode, root.audioInput, root.streamNode] + property var values: [root.audioNode, root.audioInput, root.streamNode, root.recordingNode] } } property QtObject wifi: QtObject { @@ -271,6 +284,7 @@ Item { cellWidth: ShellState.controlCenterWindow.cellWidth, extras: ShellState.controlCenterWindow.extras, streamVolume: root.streamNode.audio.volume, + streams: AudioService.streams.map(n => AudioService.streamName(n)), streamMuted: root.streamNode.audio.muted, caffeine: CaffeineService.active, caffeineRunning: CaffeineService.running, diff --git a/tests/controlcenter_runtime.py b/tests/controlcenter_runtime.py index 9bd7470..5f1d692 100644 --- a/tests/controlcenter_runtime.py +++ b/tests/controlcenter_runtime.py @@ -44,6 +44,7 @@ with tempfile.TemporaryDirectory(prefix='glassmxrph-controls-') as tmp: # Per-app volume: right click extends Sound with the app streams. assert ipc('controlTest','rightClick','outputTile');wait(lambda:state()['extras'].get('output',0)>0,'Sound extends') time.sleep(.4) + assert state()['streams']==['Fixture player'],'only playback streams are listed: '+str(state()['streams']) t=next(i for i in state()['tiles'] if i['id']=='input');assert t['row']>0 assert ipc('controlTest','slider','appSlider-Fixture player');wait(lambda:state()['streamVolume']>.6,'app volume slider') assert ipc('controlTest','click','appMute-Fixture player');wait(lambda:state()['streamMuted'],'app mute')