fix pipewire warnings

This commit is contained in:
Benjamin Palko 2025-07-24 12:29:57 -04:00
parent aaeac7a5cd
commit e964ee2337

View file

@ -17,11 +17,14 @@ Clickable {
} }
onClicked: mouse => { onClicked: mouse => {
if (mouse.button == Qt.LeftButton) { if (!sink) {
sink.audio.muted = !sink.audio.muted; return
} else if (mouse.button == Qt.RightButton) {
// show menu
} }
if (mouse.button == Qt.LeftButton) {
sink.audio.muted = !sink?.audio.muted;
} else if (mouse.button == Qt.RightButton)
// show menu
{}
} }
onWheel: event => { onWheel: event => {
@ -35,7 +38,7 @@ Clickable {
states: [ states: [
State { State {
name: "muted" name: "muted"
when: clickable.sink.audio.muted when: clickable.sink?.audio.muted ?? false
PropertyChanges { PropertyChanges {
text { text {
icon: " " icon: " "
@ -44,7 +47,7 @@ Clickable {
}, },
State { State {
name: "off" name: "off"
when: clickable.sink.audio.volume <= 0 when: clickable.sink?.audio.volume <= 0
PropertyChanges { PropertyChanges {
text { text {
icon: " " icon: " "
@ -58,7 +61,7 @@ Clickable {
property string icon: " " property string icon: " "
text: `${icon} ${(Pipewire.defaultAudioSink.audio.volume * 100).toFixed()}%` text: `${icon} ${(clickable.sink?.audio.volume * 100).toFixed()}%`
font.pixelSize: Dimensions.pipewire.fontSize font.pixelSize: Dimensions.pipewire.fontSize
color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent