From a15677aadff3abb12472c1a9ff18e03d0b13afb0 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Mon, 28 Jul 2025 13:17:30 +0200 Subject: [PATCH] A few small fixes --- Bar/Modules/Volume.qml | 29 +++++++++++++++--------- Widgets/LockScreen.qml | 4 ++-- Widgets/Sidebar/Config/SettingsModal.qml | 2 +- Widgets/Sidebar/Panel/BluetoothPanel.qml | 2 +- Widgets/Sidebar/Panel/PanelPopup.qml | 2 ++ Widgets/Sidebar/Panel/WallpaperPanel.qml | 2 +- Widgets/Sidebar/Panel/WifiPanel.qml | 2 +- shell.qml | 12 +++++++--- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Bar/Modules/Volume.qml b/Bar/Modules/Volume.qml index 1961997..e07f0b9 100644 --- a/Bar/Modules/Volume.qml +++ b/Bar/Modules/Volume.qml @@ -9,19 +9,21 @@ Item { property var shell property int volume: 0 - // The total width will match the pill's width width: pillIndicator.width height: pillIndicator.height PillIndicator { id: pillIndicator - icon: shell && shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted ? "volume_off" : (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up")) + icon: shell && shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted + ? "volume_off" + : (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up")) text: volume + "%" pillColor: Theme.surfaceVariant iconCircleColor: Theme.accentPrimary iconTextColor: Theme.backgroundPrimary textColor: Theme.textPrimary + StyledTooltip { id: volumeTooltip text: "Volume: " + volume + "%\nScroll up/down to change volume.\nLeft click to open the input/output selection." @@ -47,31 +49,36 @@ Item { Connections { target: shell ?? null function onVolumeChanged() { - if (shell && shell.volume !== volume) { - volume = shell.volume - pillIndicator.text = volume + "%" - pillIndicator.icon = shell && shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted ? "volume_off" : (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up")) - pillIndicator.show() + if (shell) { + const clampedVolume = Math.max(0, Math.min(100, shell.volume)); + if (clampedVolume !== volume) { + volume = clampedVolume; + pillIndicator.text = volume + "%"; + pillIndicator.icon = shell.defaultAudioSink && shell.defaultAudioSink.audio && shell.defaultAudioSink.audio.muted + ? "volume_off" + : (volume === 0 ? "volume_off" : (volume < 30 ? "volume_down" : "volume_up")); + pillIndicator.show(); + } } } } Component.onCompleted: { if (shell && shell.volume !== undefined) { - volume = shell.volume - pillIndicator.show() + volume = Math.max(0, Math.min(100, shell.volume)); + pillIndicator.show(); } } MouseArea { anchors.fill: parent hoverEnabled: true - acceptedButtons: Qt.NoButton // Accept wheel events only + acceptedButtons: Qt.NoButton propagateComposedEvents: true onEntered: volumeDisplay.containsMouse = true onExited: volumeDisplay.containsMouse = false cursorShape: Qt.PointingHandCursor - onWheel:(wheel) => { + onWheel: (wheel) => { if (!shell) return; let step = 5; if (wheel.angleDelta.y > 0) { diff --git a/Widgets/LockScreen.qml b/Widgets/LockScreen.qml index 82e63c7..49b3247 100644 --- a/Widgets/LockScreen.qml +++ b/Widgets/LockScreen.qml @@ -322,7 +322,7 @@ WlSessionLock { position: "bottomleft" size: 1.3 fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" - offsetX: screen.width / 2 + 31 + offsetX: screen.width / 2 + 30 offsetY: 0 anchors.top: parent.top //anchors.horizontalCenter: parent.horizontalCenter @@ -335,7 +335,7 @@ WlSessionLock { position: "bottomright" size: 1.3 fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" - offsetX: - Screen.width / 2 - 31 + offsetX: - Screen.width / 2 - 30 offsetY: 0 anchors.top: parent.top //anchors.horizontalCenter: parent.horizontalCenter diff --git a/Widgets/Sidebar/Config/SettingsModal.qml b/Widgets/Sidebar/Config/SettingsModal.qml index bd31390..d4d4ccf 100644 --- a/Widgets/Sidebar/Config/SettingsModal.qml +++ b/Widgets/Sidebar/Config/SettingsModal.qml @@ -10,7 +10,7 @@ import qs.Components PanelWindow { id: settingsModal implicitWidth: 480 - implicitHeight: 800 + implicitHeight: 780 visible: false color: "transparent" anchors.top: true diff --git a/Widgets/Sidebar/Panel/BluetoothPanel.qml b/Widgets/Sidebar/Panel/BluetoothPanel.qml index 1320cdd..f87aa8f 100644 --- a/Widgets/Sidebar/Panel/BluetoothPanel.qml +++ b/Widgets/Sidebar/Panel/BluetoothPanel.qml @@ -73,7 +73,7 @@ Item { PanelWindow { id: bluetoothPanelModal implicitWidth: 480 - implicitHeight: 800 + implicitHeight: 780 visible: false color: "transparent" anchors.top: true diff --git a/Widgets/Sidebar/Panel/PanelPopup.qml b/Widgets/Sidebar/Panel/PanelPopup.qml index 2217bf3..a656072 100644 --- a/Widgets/Sidebar/Panel/PanelPopup.qml +++ b/Widgets/Sidebar/Panel/PanelPopup.qml @@ -373,6 +373,7 @@ PanelWithOverlay { anchors.top: mainRectangle.top offsetX: -447 + sidebarPopupRect.slideOffset offsetY: 0 + visible: Settings.settings.showCorners Behavior on offsetX { enabled: !sidebarPopupRect.isAnimating @@ -390,6 +391,7 @@ PanelWithOverlay { fillColor: Theme.backgroundPrimary offsetX: 33 + sidebarPopupRect.slideOffset offsetY: 46 + visible: Settings.settings.showCorners Behavior on offsetX { enabled: !sidebarPopupRect.isAnimating diff --git a/Widgets/Sidebar/Panel/WallpaperPanel.qml b/Widgets/Sidebar/Panel/WallpaperPanel.qml index dd0c4e2..aa444a5 100644 --- a/Widgets/Sidebar/Panel/WallpaperPanel.qml +++ b/Widgets/Sidebar/Panel/WallpaperPanel.qml @@ -11,7 +11,7 @@ import qs.Services PanelWindow { id: wallpaperPanelModal implicitWidth: 480 - implicitHeight: 800 + implicitHeight: 780 visible: false color: "transparent" anchors.top: true diff --git a/Widgets/Sidebar/Panel/WifiPanel.qml b/Widgets/Sidebar/Panel/WifiPanel.qml index f1d026b..7a45f31 100644 --- a/Widgets/Sidebar/Panel/WifiPanel.qml +++ b/Widgets/Sidebar/Panel/WifiPanel.qml @@ -354,7 +354,7 @@ Item { PanelWindow { id: wifiPanelModal implicitWidth: 480 - implicitHeight: 800 + implicitHeight: 780 visible: false color: "transparent" anchors.top: true diff --git a/shell.qml b/shell.qml index 8cb676c..7459e94 100644 --- a/shell.qml +++ b/shell.qml @@ -21,10 +21,17 @@ Scope { property var notificationHistoryWin: notificationHistoryWin property bool pendingReload: false + // Helper function to round value to nearest step + function roundToStep(value, step) { + return Math.round(value / step) * step; + } + function updateVolume(vol) { - volume = vol; + var clamped = Math.max(0, Math.min(100, vol)); + var stepped = roundToStep(clamped, 5); + volume = stepped; if (defaultAudioSink && defaultAudioSink.audio) { - defaultAudioSink.audio.volume = vol / 100; + defaultAudioSink.audio.volume = stepped / 100; } } @@ -83,7 +90,6 @@ Scope { barVisible: bar.visible } - // Notification History Window NotificationHistory { id: notificationHistoryWin }