49 lines
1.1 KiB
QML
49 lines
1.1 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import "../services" as S
|
|
|
|
PanelWindow {
|
|
id: root
|
|
|
|
required property var screen
|
|
|
|
color: "transparent"
|
|
WlrLayershell.layer: WlrLayer.Background
|
|
WlrLayershell.exclusiveZone: -1
|
|
WlrLayershell.namespace: "nova-screenshot"
|
|
mask: Region {}
|
|
|
|
anchors.top: true
|
|
anchors.left: true
|
|
anchors.right: true
|
|
anchors.bottom: true
|
|
|
|
ScreencopyView {
|
|
id: _capture
|
|
anchors.fill: parent
|
|
captureSource: root.screen
|
|
visible: false
|
|
}
|
|
|
|
Connections {
|
|
target: S.ScreenshotService
|
|
function onCaptureRequested() {
|
|
_capture.captureFrame();
|
|
_grabTimer.start();
|
|
}
|
|
}
|
|
|
|
// Brief delay for the frame to arrive, then grab
|
|
Timer {
|
|
id: _grabTimer
|
|
interval: 50
|
|
onTriggered: {
|
|
_capture.visible = true;
|
|
_capture.grabToImage(result => {
|
|
_capture.visible = false;
|
|
S.ScreenshotService.store(root.screen.name, result);
|
|
});
|
|
}
|
|
}
|
|
}
|