quickshell: fix volume widget with PwObjectTracker binding
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1e7427ec0d
commit
b3fdfda1ec
1 changed files with 15 additions and 11 deletions
|
|
@ -734,7 +734,12 @@ in
|
||||||
width: volText.width
|
width: volText.width
|
||||||
height: 30
|
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 int vol: sink && sink.audio ? Math.round(sink.audio.volume * 100) : 0
|
||||||
property bool muted: sink && sink.audio ? sink.audio.muted : false
|
property bool muted: sink && sink.audio ? sink.audio.muted : false
|
||||||
property string volIcon: muted ? "\u{f0581}"
|
property string volIcon: muted ? "\u{f0581}"
|
||||||
|
|
@ -1462,12 +1467,12 @@ in
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
height: 1
|
height: 1
|
||||||
color: Theme.base02
|
color: Theme.base02
|
||||||
visible: appStreamsRepeater.count > 0
|
visible: appStreamsCol.childrenRect.height > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// App streams header
|
// App streams header
|
||||||
Text {
|
Text {
|
||||||
visible: appStreamsRepeater.count > 0
|
visible: appStreamsCol.childrenRect.height > 0
|
||||||
text: "\u{f0641} Applications"
|
text: "\u{f0641} Applications"
|
||||||
color: Theme.base05
|
color: Theme.base05
|
||||||
font.family: "FiraMono Nerd Font"
|
font.family: "FiraMono Nerd Font"
|
||||||
|
|
@ -1477,24 +1482,23 @@ in
|
||||||
|
|
||||||
// Per-app streams
|
// Per-app streams
|
||||||
Column {
|
Column {
|
||||||
|
id: appStreamsCol
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: appStreamsRepeater
|
id: appStreamsRepeater
|
||||||
model: {
|
model: Pipewire.nodes
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
required property var modelData
|
required property var modelData
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
visible: modelData.isStream && modelData.audio !== null
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
objects: [modelData]
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: modelData.name || "Unknown"
|
text: modelData.name || "Unknown"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue