Created attachment 252525 [details] use sysctl to get executablePath of specified pid x11-wm/plasma6-kwin wayland in spectacle you get always a not athorized to take screenshots, because of this check https://github.com/KDE/kwin/blob/1240ac1dfe4569f3bb5d5d182ae3c393dc2c5bd5/src/plugins/screenshot/screenshotdbusinterface2.cpp#L331-L354 The linux specific code is here: https://github.com/KDE/kwin/blob/1240ac1dfe4569f3bb5d5d182ae3c393dc2c5bd5/src/utils/serviceutils.h#L67 The attached patch uses sysctl to get the executableName You also need to workaorund https://bugreports.qt.io/browse/QTBUG-126300 by setting TZ explicitly, otherwise spectacle crashed on saving the taken snapshot to a file..
It feels like I fixed the similar problem in SSSD https://github.com/freebsd/freebsd-ports/blob/main/security/sssd2/files/patch-src__util__find_uid.c#L7
This leaks memory. You should use QString::fromLocal8Bit() to create a QString and then free the C string.
Created attachment 255745 [details] the patch that ChatGPT produced for me To this message, I am attaching a patch that ChatGPT created for me.