From b3fdfda1ec7343ac7218fc6438b6cda6ccef0ba9 Mon Sep 17 00:00:00 2001 From: rope Date: Wed, 27 May 2026 09:27:30 +0100 Subject: [PATCH] quickshell: fix volume widget with PwObjectTracker binding Co-Authored-By: Claude Opus 4.6 --- settings/hyprland.nix | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index dee76cf..e6813e1 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -734,7 +734,12 @@ in width: volText.width height: 30 - property var sink: Pipewire.defaultAudioSink + property PwNode sink: Pipewire.defaultAudioSink + + PwObjectTracker { + objects: [volWidget.sink] + } + property int vol: sink && sink.audio ? Math.round(sink.audio.volume * 100) : 0 property bool muted: sink && sink.audio ? sink.audio.muted : false property string volIcon: muted ? "\u{f0581}" @@ -1462,12 +1467,12 @@ in anchors.horizontalCenter: parent.horizontalCenter height: 1 color: Theme.base02 - visible: appStreamsRepeater.count > 0 + visible: appStreamsCol.childrenRect.height > 0 } // App streams header Text { - visible: appStreamsRepeater.count > 0 + visible: appStreamsCol.childrenRect.height > 0 text: "\u{f0641} Applications" color: Theme.base05 font.family: "FiraMono Nerd Font" @@ -1477,24 +1482,23 @@ in // Per-app streams Column { + id: appStreamsCol width: parent.width spacing: 6 Repeater { id: appStreamsRepeater - model: { - let streams = []; - for (let i = 0; i < Pipewire.nodes.values.length; i++) { - let node = Pipewire.nodes.values[i]; - if (node.isStream && node.audio) streams.push(node); - } - return streams; - } + model: Pipewire.nodes Column { required property var modelData width: parent.width spacing: 2 + visible: modelData.isStream && modelData.audio !== null + + PwObjectTracker { + objects: [modelData] + } Text { text: modelData.name || "Unknown"