mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
LockScreen: add slight delay for pam to initilize before suspend
This commit is contained in:
@@ -20,7 +20,26 @@ Loader {
|
||||
// Track if the visualizer should be shown (lockscreen active + media playing + non-compact mode)
|
||||
readonly property bool needsCava: root.active && !Settings.data.general.compactLockScreen && Settings.data.audio.visualizerType !== "" && Settings.data.audio.visualizerType !== "none"
|
||||
|
||||
// Readiness for suspend - wait a bit to ensure PAM (fprintd) has time to initialize
|
||||
property bool readyForSuspend: false
|
||||
|
||||
Timer {
|
||||
id: suspendReadinessTimer
|
||||
interval: 800 // 800ms should be enough for PAM to start
|
||||
repeat: false
|
||||
running: root.active
|
||||
onTriggered: {
|
||||
root.readyForSuspend = true;
|
||||
Logger.i("LockScreen", "Ready for suspend (PAM initialization time elapsed)");
|
||||
}
|
||||
}
|
||||
|
||||
onActiveChanged: {
|
||||
if (root.active) {
|
||||
root.readyForSuspend = false;
|
||||
suspendReadinessTimer.restart();
|
||||
}
|
||||
|
||||
if (root.active && root.needsCava) {
|
||||
CavaService.registerComponent("lockscreen");
|
||||
} else {
|
||||
|
||||
@@ -478,12 +478,29 @@ Singleton {
|
||||
|
||||
// Check if lock screen is now active
|
||||
if (PanelService && PanelService.lockScreen && PanelService.lockScreen.active) {
|
||||
// Verify the lock screen component is loaded
|
||||
// Verify the lock screen component is loaded AND ready
|
||||
if (PanelService.lockScreen.item) {
|
||||
Logger.i("Compositor", "Lock screen confirmed active, suspending");
|
||||
stop();
|
||||
lockAndSuspendCheckCount = 0;
|
||||
suspend();
|
||||
// Check if the lock screen says it's ready for suspend (PAM initialized)
|
||||
// If property doesn't exist (older version), assume ready
|
||||
var isReady = true;
|
||||
if (PanelService.lockScreen.item.readyForSuspend !== undefined) {
|
||||
isReady = PanelService.lockScreen.item.readyForSuspend;
|
||||
}
|
||||
|
||||
if (isReady) {
|
||||
Logger.i("Compositor", "Lock screen active and ready, suspending");
|
||||
stop();
|
||||
lockAndSuspendCheckCount = 0;
|
||||
suspend();
|
||||
} else {
|
||||
// Lock screen active but not ready yet (waiting for timer)
|
||||
if (lockAndSuspendCheckCount > 25) { // 2.5 seconds max wait total
|
||||
Logger.w("Compositor", "Lock screen timed out waiting for readiness, suspending anyway");
|
||||
stop();
|
||||
lockAndSuspendCheckCount = 0;
|
||||
suspend();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Lock screen is active but component not loaded yet, wait a bit more
|
||||
if (lockAndSuspendCheckCount > 20) {
|
||||
|
||||
Reference in New Issue
Block a user