From e2a0e491a0e649457604d0348f126e26c1dd9c64 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Wed, 13 Aug 2025 14:03:02 +0200 Subject: [PATCH] Add audoOverdrive to Volume Symbol in bar --- Modules/Bar/Volume.qml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Modules/Bar/Volume.qml b/Modules/Bar/Volume.qml index 3f14d22..5e02908 100644 --- a/Modules/Bar/Volume.qml +++ b/Modules/Bar/Volume.qml @@ -28,17 +28,17 @@ Item { } function getIconColor() { - return (Audio.volume <= 1.0) ? Colors.textPrimary : getVolumeColor() + return (getDisplayVolume() <= 1.0) ? Colors.textPrimary : getVolumeColor() } function getVolumeColor() { - if (Audio.volume <= 1.0) { + if (getDisplayVolume() <= 1.0) { return Colors.accentPrimary } // Indicate that the volume is over 100% // Calculate interpolation factor (0 at 100%, 1.0 at 200%) - let factor = (Audio.volume - 1.0) + let factor = (getDisplayVolume() - 1.0) // Blend between accent and warning colors return Qt.rgba(Colors.accentPrimary.r + (Colors.error.r - Colors.accentPrimary.r) * factor, @@ -46,6 +46,15 @@ Item { Colors.accentPrimary.b + (Colors.error.b - Colors.accentPrimary.b) * factor, 1) } + function getDisplayVolume() { + // If volumeOverdrive is false, clamp to 100% + if (!Settings.data.audio || !Settings.data.audio.volumeOverdrive) { + return Math.min(Audio.volume, 1.0) + } + // If volumeOverdrive is true, allow up to 200% + return Math.min(Audio.volume, 2.0) + } + // Connection used to open the pill when volume changes Connections { target: Audio.sink?.audio ? Audio.sink?.audio : null @@ -66,9 +75,9 @@ Item { iconCircleColor: getVolumeColor() collapsedIconColor: getIconColor() autoHide: true - text: Math.round(Audio.volume * 100) + "%" + text: Math.round(getDisplayVolume() * 100) + "%" tooltipText: "Volume: " + Math.round( - Audio.volume * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume." + getDisplayVolume() * 100) + "%\nLeft click for advanced settings.\nScroll up/down to change volume." onWheel: function (angle) { if (angle > 0) {