1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-12 08:42:13 -04:00

lock: send lockerReady after frame rendered

This commit is contained in:
bbedward
2025-10-22 16:54:34 -04:00
parent 1db4e92779
commit bbe802037e

View File

@@ -4,6 +4,7 @@ import QtCore
import QtQuick import QtQuick
import QtQuick.Effects import QtQuick.Effects
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Services.Mpris import Quickshell.Services.Mpris
@@ -23,6 +24,8 @@ Item {
property string hyprlandCurrentLayout: "" property string hyprlandCurrentLayout: ""
property string hyprlandKeyboard: "" property string hyprlandKeyboard: ""
property int hyprlandLayoutCount: 0 property int hyprlandLayoutCount: 0
property bool lockerReadySent: false
property bool lockerReadyArmed: false
signal unlockRequested signal unlockRequested
@@ -43,15 +46,7 @@ Item {
hyprlandLayoutUpdateTimer.start() hyprlandLayoutUpdateTimer.start()
} }
if (SessionService.loginctlAvailable && DMSService.apiVersion >= 2) { lockerReadyArmed = true
DMSService.sendRequest("loginctl.lockerReady", null, response => {
if (response.error) {
console.warn("LockScreenContent: Failed to signal locker ready:", response.error)
} else {
console.log("LockScreenContent: Locker ready signaled, inhibitor released")
}
})
}
} }
onDemoModeChanged: { onDemoModeChanged: {
if (demoMode) { if (demoMode) {
@@ -65,6 +60,37 @@ Item {
} }
} }
function sendLockerReadyOnce() {
if (lockerReadySent) return;
lockerReadySent = true;
if (SessionService.loginctlAvailable && DMSService.apiVersion >= 2) {
DMSService.sendRequest("loginctl.lockerReady", null, resp => {
if (resp?.error) console.warn("lockerReady failed:", resp.error)
else console.log("lockerReady sent (afterAnimating/afterRendering)");
});
}
}
function maybeSend() {
if (!lockerReadyArmed) return;
if (!root.visible || root.opacity <= 0) return;
Qt.callLater(() => {
if (root.visible && root.opacity > 0)
sendLockerReadyOnce();
});
}
Connections {
target: root.Window.window
enabled: target !== null
function onAfterAnimating() { maybeSend(); }
function onAfterRendering() { maybeSend(); }
}
onVisibleChanged: maybeSend()
onOpacityChanged: maybeSend()
function updateHyprlandLayout() { function updateHyprlandLayout() {
if (CompositorService.isHyprland) { if (CompositorService.isHyprland) {
hyprlandLayoutProcess.running = true hyprlandLayoutProcess.running = true