From d5c12647971e800e19421e8443d570c516b5f590 Mon Sep 17 00:00:00 2001 From: ly-sec Date: Mon, 14 Jul 2025 14:40:53 +0200 Subject: [PATCH] Revert "Fix volume scrolling" This reverts commit bed4c3ca7a0c793fceff4727181f146fa4ca10d8. --- Bar/Modules/Volume.qml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Bar/Modules/Volume.qml b/Bar/Modules/Volume.qml index 754234c..ad93fe7 100644 --- a/Bar/Modules/Volume.qml +++ b/Bar/Modules/Volume.qml @@ -24,12 +24,14 @@ Item { } Connections { - target: shell && shell.defaultAudioSink && shell.defaultAudioSink.audio ? shell.defaultAudioSink.audio : null - onVolumeChanged: { - volume = Math.round(shell.defaultAudioSink.audio.volume * 100); - pillIndicator.text = volume + "%"; - pillIndicator.icon = volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up"); - pillIndicator.show(); + target: shell ?? null + function onVolumeChanged() { + if (shell && shell.volume !== volume) { + volume = shell.volume + pillIndicator.text = volume + "%" + pillIndicator.icon = volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up") + pillIndicator.show() + } } } @@ -46,15 +48,13 @@ Item { acceptedButtons: Qt.NoButton // Accept wheel events only propagateComposedEvents: true onWheel: { - if (!shell || !shell.defaultAudioSink || !shell.defaultAudioSink.audio) return; - let step = 0.05; // 5% as float - let newVolume = shell.defaultAudioSink.audio.volume; + if (!shell) return; + let step = 5; if (wheel.angleDelta.y > 0) { - newVolume = Math.min(1, newVolume + step); + shell.volume = Math.min(100, shell.volume + step); } else if (wheel.angleDelta.y < 0) { - newVolume = Math.max(0, newVolume - step); + shell.volume = Math.max(0, shell.volume - step); } - shell.defaultAudioSink.audio.volume = newVolume; } } }