From bcfd7358080af6e2da3d287400b23f3a2abf98eb Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Thu, 1 Dec 2022 21:28:26 +0100 Subject: [PATCH] effects/screenshot: offer an opt out of permission checking in a CI context the paths are mutable between installation and use and as such the permission checks can just not ever work. for use in such scenarios allow completely disabling the permission checks --- src/effects/screenshot/screenshotdbusinterface1.cpp | 5 +++++ src/effects/screenshot/screenshotdbusinterface2.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/effects/screenshot/screenshotdbusinterface1.cpp b/src/effects/screenshot/screenshotdbusinterface1.cpp index dce7ce89df..251b43f870 100644 --- a/src/effects/screenshot/screenshotdbusinterface1.cpp +++ b/src/effects/screenshot/screenshotdbusinterface1.cpp @@ -507,6 +507,11 @@ bool ScreenShotDBusInterface1::checkCall() const return false; } + static bool permissionCheckDisabled = qEnvironmentVariableIntValue("KWIN_SCREENSHOT_NO_PERMISSION_CHECKS") == 1; + if (permissionCheckDisabled) { + return true; + } + const QDBusReply reply = connection().interface()->servicePid(message().service()); if (reply.isValid()) { const uint pid = reply.value(); diff --git a/src/effects/screenshot/screenshotdbusinterface2.cpp b/src/effects/screenshot/screenshotdbusinterface2.cpp index d0c6bd9910..d771f0e5bb 100644 --- a/src/effects/screenshot/screenshotdbusinterface2.cpp +++ b/src/effects/screenshot/screenshotdbusinterface2.cpp @@ -286,6 +286,11 @@ bool ScreenShotDBusInterface2::checkPermissions() const return false; } + static bool permissionCheckDisabled = qEnvironmentVariableIntValue("KWIN_SCREENSHOT_NO_PERMISSION_CHECKS") == 1; + if (permissionCheckDisabled) { + return true; + } + const QDBusReply reply = connection().interface()->servicePid(message().service()); if (reply.isValid()) { const uint pid = reply.value();