From 14af84ffbe3b944d589519dff72996d6bd527f16 Mon Sep 17 00:00:00 2001 From: lysec Date: Sun, 12 Oct 2025 16:01:31 +0200 Subject: [PATCH] LockScreen: make compact version buttons not overflow & edit clock CalendarPanel: edit clock Autoformat --- Modules/Bar/Calendar/CalendarPanel.qml | 10 +++-- Modules/LockScreen/LockScreen.qml | 56 ++++++++++++++++---------- Modules/OSD/OSD.qml | 6 ++- Widgets/NCircleStat.qml | 6 +-- Widgets/NPanel.qml | 16 ++++---- 5 files changed, 56 insertions(+), 38 deletions(-) diff --git a/Modules/Bar/Calendar/CalendarPanel.qml b/Modules/Bar/Calendar/CalendarPanel.qml index e8240e84..3b1b26a8 100644 --- a/Modules/Bar/Calendar/CalendarPanel.qml +++ b/Modules/Bar/Calendar/CalendarPanel.qml @@ -10,6 +10,8 @@ import qs.Widgets NPanel { id: root + readonly property var now: Time.date + preferredWidth: Settings.data.location.showWeekNumberInCalendar ? 400 : 380 preferredHeight: 520 @@ -193,12 +195,12 @@ NPanel { Canvas { id: secondsProgress anchors.fill: parent - property real progress: Time.date.getSeconds() / 60 + property real progress: now.getSeconds() / 60 onProgressChanged: requestPaint() Connections { target: Time function onDateChanged() { - const total = Time.date.getSeconds() * 1000 + Time.date.getMilliseconds() + const total = now.getSeconds() * 1000 + now.getMilliseconds() secondsProgress.progress = total / 60000 } } @@ -233,7 +235,7 @@ NPanel { NText { text: { - var t = Settings.data.location.use12hourFormat ? Qt.locale().toString(Time.date, "hh AP") : Qt.locale().toString(Time.date, "HH") + var t = Settings.data.location.use12hourFormat ? Qt.locale().toString(now, "hh AP") : Qt.locale().toString(now, "HH") return t.split(" ")[0] } @@ -245,7 +247,7 @@ NPanel { } NText { - text: Qt.formatTime(Time.date, "mm") + text: Qt.formatTime(now, "mm") pointSize: Style.fontSizeXXS * scaling font.weight: Style.fontWeightBold color: Color.mOnPrimary diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index a4f1d16d..1cb4a532 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -50,6 +50,7 @@ Loader { WlSessionLockSurface { readonly property real scaling: ScalingService.dynamicScale(screen) + readonly property var now: Time.date Item { id: batteryIndicator @@ -341,7 +342,6 @@ Loader { } } - // Spacer to push time to the right Item { Layout.fillWidth: true @@ -469,7 +469,7 @@ Loader { width: { var hasBattery = UPower.displayDevice && UPower.displayDevice.ready && UPower.displayDevice.isPresent var hasKeyboard = keyboardLayout.currentLayout !== "Unknown" - + if (hasBattery && hasKeyboard) { return 200 * scaling } else if (hasBattery || hasKeyboard) { @@ -729,7 +729,7 @@ Loader { spacing: 3 * scaling NText { - text: Qt.locale().toString(new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/")), "ddd") + text: Qt.locale().toString(now, "ddd") pointSize: Style.fontSizeM * scaling color: Color.mOnSurfaceVariant horizontalAlignment: Text.AlignHCenter @@ -798,10 +798,8 @@ Loader { } } } - } - // Password input RowLayout { Layout.fillWidth: true @@ -811,7 +809,6 @@ Loader { Layout.preferredWidth: Style.marginM * scaling } - Rectangle { Layout.fillWidth: true Layout.preferredHeight: 48 * scaling @@ -956,7 +953,6 @@ Loader { } } - Item { Layout.preferredWidth: Style.marginM * scaling } @@ -965,7 +961,7 @@ Loader { // System control buttons RowLayout { Layout.fillWidth: true - Layout.preferredHeight: 48 * scaling + Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling spacing: 10 * scaling Item { @@ -974,9 +970,11 @@ Loader { Rectangle { Layout.fillWidth: true - Layout.preferredHeight: 48 * scaling - radius: 24 * scaling + Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling + radius: Settings.data.general.compactLockScreen ? 18 * scaling : 24 * scaling color: logoutButtonArea.containsMouse ? Color.mTertiary : "transparent" + border.color: Color.mOutline + border.width: 1 RowLayout { anchors.centerIn: parent @@ -984,14 +982,14 @@ Loader { NIcon { icon: "logout" - pointSize: Style.fontSizeL * scaling + pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM * scaling : Style.fontSizeL * scaling color: logoutButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant } NText { text: I18n.tr("session-menu.logout") color: logoutButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant - pointSize: Style.fontSizeM * scaling + pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeS * scaling : Style.fontSizeM * scaling font.weight: Font.Medium } } @@ -1009,13 +1007,22 @@ Loader { easing.type: Easing.OutCubic } } + + Behavior on border.color { + ColorAnimation { + duration: 200 + easing.type: Easing.OutCubic + } + } } Rectangle { Layout.fillWidth: true - Layout.preferredHeight: 48 * scaling - radius: 24 * scaling + Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling + radius: Settings.data.general.compactLockScreen ? 18 * scaling : 24 * scaling color: rebootButtonArea.containsMouse ? Color.mTertiary : "transparent" + border.color: Color.mOutline + border.width: 1 RowLayout { anchors.centerIn: parent @@ -1023,14 +1030,14 @@ Loader { NIcon { icon: "reboot" - pointSize: Style.fontSizeL * scaling + pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM * scaling : Style.fontSizeL * scaling color: rebootButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant } NText { text: I18n.tr("session-menu.reboot") color: rebootButtonArea.containsMouse ? Color.mOnTertiary : Color.mOnSurfaceVariant - pointSize: Style.fontSizeM * scaling + pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeS * scaling : Style.fontSizeM * scaling font.weight: Font.Medium } } @@ -1048,14 +1055,21 @@ Loader { easing.type: Easing.OutCubic } } + + Behavior on border.color { + ColorAnimation { + duration: 200 + easing.type: Easing.OutCubic + } + } } Rectangle { Layout.fillWidth: true - Layout.preferredHeight: 48 * scaling - radius: 24 * scaling + Layout.preferredHeight: Settings.data.general.compactLockScreen ? 36 * scaling : 48 * scaling + radius: Settings.data.general.compactLockScreen ? 18 * scaling : 24 * scaling color: shutdownButtonArea.containsMouse ? Color.mError : "transparent" - border.color: shutdownButtonArea.containsMouse ? Color.mError : Color.transparent + border.color: shutdownButtonArea.containsMouse ? Color.mError : Color.mOutline border.width: 1 RowLayout { @@ -1064,14 +1078,14 @@ Loader { NIcon { icon: "shutdown" - pointSize: Style.fontSizeL * scaling + pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeM * scaling : Style.fontSizeL * scaling color: shutdownButtonArea.containsMouse ? Color.mOnError : Color.mOnSurfaceVariant } NText { text: I18n.tr("session-menu.shutdown") color: shutdownButtonArea.containsMouse ? Color.mOnError : Color.mOnSurfaceVariant - pointSize: Style.fontSizeM * scaling + pointSize: Settings.data.general.compactLockScreen ? Style.fontSizeS * scaling : Style.fontSizeM * scaling font.weight: Font.Medium } } diff --git a/Modules/OSD/OSD.qml b/Modules/OSD/OSD.qml index 873933ba..12b261af 100644 --- a/Modules/OSD/OSD.qml +++ b/Modules/OSD/OSD.qml @@ -139,6 +139,7 @@ Variants { })() Component.onCompleted: { + } Connections { @@ -151,6 +152,7 @@ Variants { } Component.onDestruction: { + } // Anchor selection based on location (window edges) @@ -548,12 +550,12 @@ Variants { function onBrightnessChanged(newBrightness) { root.lastUpdatedBrightness = newBrightness - + if (!brightnessInitialized) { brightnessInitialized = true return } - + showOSD("brightness") } diff --git a/Widgets/NCircleStat.qml b/Widgets/NCircleStat.qml index 1305cec2..a0650692 100644 --- a/Widgets/NCircleStat.qml +++ b/Widgets/NCircleStat.qml @@ -27,12 +27,12 @@ Rectangle { // Repaint gauge when the bound value changes onValueChanged: gauge.requestPaint() - + // Force repaint when scaling changes onScalingChanged: { Qt.callLater(() => { - gauge.requestPaint() - }) + gauge.requestPaint() + }) } ColumnLayout { diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index e7c4c8a3..acef644e 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -146,12 +146,12 @@ Loader { Logger.log("NPanel", "Opened", root.objectName, "on", screen.name) dimmingOpacity = Style.opacityHeavy root.scaling = scaling = ScalingService.getScreenScale(screen) - + // Force refresh panel content when scaling is applied Qt.callLater(() => { - panelContentLoader.active = false - panelContentLoader.active = true - }) + panelContentLoader.active = false + panelContentLoader.active = true + }) } Connections { @@ -159,12 +159,12 @@ Loader { function onScaleChanged(screenName, scale) { if ((screen !== null) && (screenName === screen.name)) { root.scaling = scaling = scale - + // Force refresh panel content when scaling changes Qt.callLater(() => { - panelContentLoader.active = false - panelContentLoader.active = true - }) + panelContentLoader.active = false + panelContentLoader.active = true + }) } } }