Notifications: ensure they are not sandwitched between panels

+ Always access lockScreen via panel service and removed deprecation
notice.
This commit is contained in:
ItsLemmy
2025-11-21 15:18:38 -05:00
parent f46915d2c3
commit 7a68030f69
5 changed files with 19 additions and 105 deletions
+8 -68
View File
@@ -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
+4 -4
View File
@@ -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
+2 -18
View File
@@ -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;
}
}
}
+1 -2
View File
@@ -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
+4 -13
View File
@@ -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 {}
}
}