mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
237fb57d5e
lock-before-suspend released the logind sleep delay inhibitor as soon as Qt reported the lock rendered (afterAnimating/afterRendering). That signal fires before the compositor has committed/presented the ext-session-lock surface, so the machine could freeze ~1 frame later with the desktop still the last presented frame. On resume the desktop was briefly visible before the lock appeared (both suspend and hibernate). Gate lockerReady on WlSessionLock.secure (the ext-session-lock `locked` event), so the inhibitor is held until the compositor confirms the session is locked and the desktop is hidden. LockSurface passes the WlSessionLock down as sessionLock; the readiness check returns early until secure, and re-fires on secureChanged. The Go-side fallback timer in loginctl monitor remains as the backstop. Reproduced on niri / s2idle with 3 outputs: debug log showed lockerReady sent 18 ms before `PM: suspend entry`; with this change the desktop no longer flashes on resume. Signed-off-by: Thomas Kroll <99196436+tkroll-ionos@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
74 lines
1.8 KiB
QML
74 lines
1.8 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell.Wayland
|
|
import qs.Common
|
|
|
|
FocusScope {
|
|
id: root
|
|
|
|
required property WlSessionLock lock
|
|
required property var pam
|
|
required property string sharedPasswordBuffer
|
|
required property string screenName
|
|
required property bool isLocked
|
|
|
|
signal passwordChanged(string newPassword)
|
|
signal unlockRequested
|
|
|
|
Keys.onPressed: event => {
|
|
if (videoScreensaver.active && videoScreensaver.inputEnabled) {
|
|
videoScreensaver.dismiss();
|
|
event.accepted = true;
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: "transparent"
|
|
}
|
|
|
|
LockScreenContent {
|
|
id: lockContent
|
|
|
|
anchors.fill: parent
|
|
demoMode: false
|
|
sessionLock: root.lock
|
|
pam: root.pam
|
|
passwordBuffer: root.sharedPasswordBuffer
|
|
screenName: root.screenName
|
|
enabled: !videoScreensaver.active
|
|
focus: !videoScreensaver.active
|
|
opacity: videoScreensaver.active ? 0 : 1
|
|
onUnlockRequested: root.unlockRequested()
|
|
onPasswordEdited: text => root.passwordChanged(text)
|
|
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: 200
|
|
}
|
|
}
|
|
}
|
|
|
|
VideoScreensaver {
|
|
id: videoScreensaver
|
|
anchors.fill: parent
|
|
screenName: root.screenName
|
|
onDismissed: Qt.callLater(() => lockContent.focusPasswordField())
|
|
}
|
|
|
|
Component.onCompleted: forceActiveFocus()
|
|
|
|
onIsLockedChanged: {
|
|
if (isLocked) {
|
|
forceActiveFocus();
|
|
lockContent.resetLockState();
|
|
if (SettingsData.lockScreenVideoEnabled) {
|
|
videoScreensaver.start();
|
|
}
|
|
return;
|
|
}
|
|
lockContent.unlocking = false;
|
|
}
|
|
}
|