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] || "";
}
}

View file

@ -11,6 +11,7 @@ singleton NetworkService 1.0 NetworkService.qml
singleton NiriIpc 1.0 NiriIpc.qml
singleton NotifService 1.0 NotifService.qml
singleton PowerProfileService 1.0 PowerProfileService.qml
singleton ScreenshotService 1.0 ScreenshotService.qml
singleton SystemStats 1.0 SystemStats.qml
singleton Theme 1.0 Theme.qml
# keep-sorted end