pre-capture lock screen screenshots via hidden window and ScreenshotService
This commit is contained in:
parent
62cd0f9a76
commit
73e480d14b
7 changed files with 129 additions and 10 deletions
44
shell/services/ScreenshotService.qml
Normal file
44
shell/services/ScreenshotService.qml
Normal 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] || "";
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue