More LockScreen NLoader stuff
This commit is contained in:
parent
d688d04b77
commit
20b7872fad
3 changed files with 5 additions and 18 deletions
|
|
@ -42,7 +42,7 @@ Item {
|
|||
target: "lockScreen"
|
||||
|
||||
function toggle() {
|
||||
lockScreen.locked = !lockScreen.locked
|
||||
lockScreen.isLoaded = !lockScreen.isLoaded
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,23 +14,12 @@ import qs.Widgets
|
|||
|
||||
NLoader {
|
||||
id: lockScreen
|
||||
// External API
|
||||
property bool locked: false
|
||||
// Internal loader control; keep content alive briefly after unlocking
|
||||
property bool _isLoadedInternal: false
|
||||
// Only load when explicitly requested (locked) or while waiting to safely unload
|
||||
isLoaded: _isLoadedInternal
|
||||
onLockedChanged: {
|
||||
if (locked) {
|
||||
_isLoadedInternal = true
|
||||
}
|
||||
}
|
||||
// Allow a small grace period after unlocking so the compositor releases the lock surfaces
|
||||
Timer {
|
||||
id: unloadAfterUnlockTimer
|
||||
interval: 250
|
||||
repeat: false
|
||||
onTriggered: lockScreen._isLoadedInternal = false
|
||||
onTriggered: lockScreen.isLoaded = false
|
||||
}
|
||||
function scheduleUnloadAfterUnlock() {
|
||||
unloadAfterUnlockTimer.start()
|
||||
|
|
@ -38,9 +27,8 @@ NLoader {
|
|||
content: Component {
|
||||
WlSessionLock {
|
||||
id: lock
|
||||
// Keep inner lock state in sync with wrapper
|
||||
locked: lockScreen.locked
|
||||
onLockedChanged: lockScreen.locked = locked
|
||||
// Tie session lock to loader visibility
|
||||
locked: lockScreen.isLoaded
|
||||
|
||||
// Lockscreen is a different beast, needs a capital 'S' in 'Screen' to get the current screen
|
||||
readonly property real scaling: ScalingService.scale(Screen)
|
||||
|
|
@ -82,7 +70,6 @@ NLoader {
|
|||
Logger.log("LockScreen", "Authentication successful, unlocking")
|
||||
// First release the Wayland session lock, then unload after a short delay
|
||||
lock.locked = false
|
||||
lockScreen.locked = false
|
||||
lockScreen.scheduleUnloadAfterUnlock()
|
||||
lock.password = ""
|
||||
lock.errorMessage = ""
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ NPanel {
|
|||
onClicked: {
|
||||
Logger.log("PowerMenu", "Lock screen requested")
|
||||
// Lock the screen
|
||||
lockScreen.locked = true
|
||||
lockScreen.isLoaded = true
|
||||
powerMenu.visible = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue