pre-capture lock screen screenshots via hidden window and ScreenshotService

This commit is contained in:
Damocles 2026-04-18 12:32:55 +02:00
parent 62cd0f9a76
commit 73e480d14b
7 changed files with 129 additions and 10 deletions

View file

@ -0,0 +1,44 @@
pragma Singleton
import QtQuick
QtObject {
id: root
// Screen name -> in-memory image URL from grabToImage
property var screenshots: ({})
property int _pending: 0
// Keep references to prevent garbage collection of the image data
property var _results: ({})
signal captureRequested
signal captureComplete
function capture(screenCount) {
_pending = screenCount;
if (_pending === 0) {
captureComplete();
return;
}
captureRequested();
}
function store(screenName, result) {
const s = Object.assign({}, screenshots);
s[screenName] = result.url;
screenshots = s;
const r = Object.assign({}, _results);
r[screenName] = result;
_results = r;
_pending--;
if (_pending <= 0)
captureComplete();
}
function get(screenName) {
return screenshots[screenName] || "";
}
}