diff --git a/src/effects/screenshot/org.kde.KWin.ScreenShot2.xml b/src/effects/screenshot/org.kde.KWin.ScreenShot2.xml
index 8a726d45a7..00490c6ef8 100644
--- a/src/effects/screenshot/org.kde.KWin.ScreenShot2.xml
+++ b/src/effects/screenshot/org.kde.KWin.ScreenShot2.xml
@@ -269,5 +269,45 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/effects/screenshot/screenshotdbusinterface2.cpp b/src/effects/screenshot/screenshotdbusinterface2.cpp
index 70a2be3c4c..a4c911a7a9 100644
--- a/src/effects/screenshot/screenshotdbusinterface2.cpp
+++ b/src/effects/screenshot/screenshotdbusinterface2.cpp
@@ -290,7 +290,7 @@ ScreenShotDBusInterface2::~ScreenShotDBusInterface2()
int ScreenShotDBusInterface2::version() const
{
- return 2;
+ return 3;
}
bool ScreenShotDBusInterface2::checkPermissions() const
@@ -514,6 +514,25 @@ QVariantMap ScreenShotDBusInterface2::CaptureInteractive(uint kind,
return QVariantMap();
}
+QVariantMap ScreenShotDBusInterface2::CaptureWorkspace(const QVariantMap &options, QDBusUnixFileDescriptor pipe)
+{
+ if (!checkPermissions()) {
+ return QVariantMap();
+ }
+
+ const int fileDescriptor = dup(pipe.fileDescriptor());
+ if (fileDescriptor == -1) {
+ sendErrorReply(s_errorFileDescriptor, s_errorFileDescriptorMessage);
+ return QVariantMap();
+ }
+
+ takeScreenShot(effects->virtualScreenGeometry(), screenShotFlagsFromOptions(options),
+ new ScreenShotSinkPipe2(fileDescriptor, message()));
+
+ setDelayedReply(true);
+ return QVariantMap();
+}
+
void ScreenShotDBusInterface2::bind(ScreenShotSinkPipe2 *sink, ScreenShotSource2 *source)
{
connect(source, &ScreenShotSource2::cancelled, sink, [sink, source]() {
diff --git a/src/effects/screenshot/screenshotdbusinterface2.h b/src/effects/screenshot/screenshotdbusinterface2.h
index 4bc472b8c5..7e202f9271 100644
--- a/src/effects/screenshot/screenshotdbusinterface2.h
+++ b/src/effects/screenshot/screenshotdbusinterface2.h
@@ -53,6 +53,8 @@ public Q_SLOTS:
QDBusUnixFileDescriptor pipe);
QVariantMap CaptureInteractive(uint kind, const QVariantMap &options,
QDBusUnixFileDescriptor pipe);
+ QVariantMap CaptureWorkspace(const QVariantMap &options,
+ QDBusUnixFileDescriptor pipe);
private:
void takeScreenShot(EffectScreen *screen, ScreenShotFlags flags, ScreenShotSinkPipe2 *sink);