From 7a68030f69262c65c6a5e3fe62861d863ce10c45 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Fri, 21 Nov 2025 15:18:38 -0500 Subject: [PATCH] Notifications: ensure they are not sandwitched between panels + Always access lockScreen via panel service and removed deprecation notice. --- Modules/LockScreen/LockScreen.qml | 76 +++------------------------ Modules/Notification/Notification.qml | 8 +-- Services/Control/IPCService.qml | 20 +------ Services/UI/PanelService.qml | 3 +- shell.qml | 17 ++---- 5 files changed, 19 insertions(+), 105 deletions(-) diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index f5af0071c..ee4afe6b7 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -20,21 +20,19 @@ import qs.Widgets import qs.Widgets.AudioSpectrum Loader { - id: lockScreen + id: root active: false - // Track if triggered via deprecated IPC call - property bool triggeredViaDeprecatedCall: false + Component.onCompleted: { + // Register with panel service + PanelService.lockScreen = this; + } Timer { id: unloadAfterUnlockTimer interval: 250 repeat: false - onTriggered: { - lockScreen.active = false; - // Reset the deprecation flag when unlocking - lockScreen.triggeredViaDeprecatedCall = false; - } + onTriggered: root.active = false } function scheduleUnloadAfterUnlock() { @@ -49,7 +47,7 @@ Loader { id: lockContext onUnlocked: { lockSession.locked = false; - lockScreen.scheduleUnloadAfterUnlock(); + root.scheduleUnloadAfterUnlock(); lockContext.currentText = ""; } onFailed: { @@ -59,7 +57,7 @@ Loader { WlSessionLock { id: lockSession - locked: lockScreen.active + locked: root.active WlSessionLockSurface { readonly property var now: Time.now @@ -383,64 +381,6 @@ Loader { } } - // Deprecation warning (shown above error notification) - Rectangle { - width: Math.min(650, parent.width - 40) - implicitHeight: deprecationContent.implicitHeight + 24 - height: implicitHeight - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: (Settings.data.general.compactLockScreen ? 320 : 400) * Style.uiScaleRatio - radius: Style.radiusL - color: Qt.alpha(Color.mTertiary, 0.95) - border.color: Color.mTertiary - border.width: 2 - visible: lockScreen.triggeredViaDeprecatedCall - opacity: visible ? 1.0 : 0.0 - - ColumnLayout { - id: deprecationContent - anchors.fill: parent - anchors.margins: 12 - spacing: 6 - - RowLayout { - Layout.alignment: Qt.AlignHCenter - spacing: 8 - - NIcon { - icon: "alert-triangle" - pointSize: Style.fontSizeL - color: Color.mOnTertiary - } - - NText { - text: "Deprecated IPC Call" - color: Color.mOnTertiary - pointSize: Style.fontSizeL - font.weight: Font.Bold - } - } - - NText { - text: "The 'lockScreen toggle' IPC call is deprecated. Use 'lockScreen lock' instead." - color: Color.mOnTertiary - pointSize: Style.fontSizeM - horizontalAlignment: Text.AlignHCenter - Layout.alignment: Qt.AlignHCenter - Layout.fillWidth: true - wrapMode: Text.WordWrap - } - } - - Behavior on opacity { - NumberAnimation { - duration: 300 - easing.type: Easing.OutCubic - } - } - } - // Error notification Rectangle { width: 450 diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 5bed17711..5dbde5d40 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -21,8 +21,8 @@ Variants { property ListModel notificationModel: NotificationService.activeList - // Loader is active when there are notifications - active: notificationModel.count > 0 || delayTimer.running + // Always create window (but with 0x0 dimensions when no notifications) + active: true // Keep loader active briefly after last notification to allow animations to complete Timer { @@ -104,8 +104,8 @@ Variants { margins.left: isLeft ? barOffsetLeft : 0 margins.right: isRight ? barOffsetRight : 0 - implicitWidth: notifWidth - implicitHeight: notificationStack.implicitHeight + Style.marginL + implicitWidth: (notificationModel.count > 0 || delayTimer.running) ? notifWidth : 0 + implicitHeight: (notificationModel.count > 0 || delayTimer.running) ? (notificationStack.implicitHeight + Style.marginL) : 0 property var animateConnection: null diff --git a/Services/Control/IPCService.qml b/Services/Control/IPCService.qml index 64b80edfe..62a97a3a2 100644 --- a/Services/Control/IPCService.qml +++ b/Services/Control/IPCService.qml @@ -120,24 +120,8 @@ Item { // New preferred method - lock the screen function lock() { // Only lock if not already locked (prevents the red screen issue) - // Note: No unlock via IPC for security reasons - if (!lockScreen.active) { - lockScreen.triggeredViaDeprecatedCall = false; - lockScreen.active = true; - } - } - - // Deprecated: Use 'lockScreen lock' instead - function toggle() { - // Mark as triggered via deprecated call - warning will show in lock screen - lockScreen.triggeredViaDeprecatedCall = true; - - // Log deprecation warning for users checking logs - Logger.w("IPC", "The 'lockScreen toggle' IPC call is deprecated. Use 'lockScreen lock' instead."); - - // Still functional for backward compatibility - if (!lockScreen.active) { - lockScreen.active = true; + if (!PanelService.lockScreen.active) { + PanelService.lockScreen.active = true; } } } diff --git a/Services/UI/PanelService.qml b/Services/UI/PanelService.qml index 1e55db04b..b09f00009 100644 --- a/Services/UI/PanelService.qml +++ b/Services/UI/PanelService.qml @@ -6,8 +6,7 @@ import qs.Commons Singleton { id: root - // A ref. to the lockScreen, so it's accessible from anywhere - // This is not a panel... + // A ref. to the lockScreen, so it's accessible from anywhere. property var lockScreen: null // Panels diff --git a/shell.qml b/shell.qml index 24fa38f6f..60937f4eb 100644 --- a/shell.qml +++ b/shell.qml @@ -92,25 +92,16 @@ ShellRoot { Overview {} Background {} + AllScreens {} Dock {} + Notification {} ToastOverlay {} OSD {} - Notification {} - LockScreen { - id: lockScreen - Component.onCompleted: { - // Save a ref. to our lockScreen so we can access it easily - PanelService.lockScreen = lockScreen; - } - } + LockScreen {} - // IPCService is treated as a service but it's actually an - // Item that needs to exists in the shell. + // IPCService is treated as a service but it's actually an Item that needs to exists in the shell. IPCService {} - - // MainScreen for each screen - AllScreens {} } }