Help with screenshot API.

Aleix Pol aleixpol at kde.org
Fri Oct 4 22:03:37 BST 2024


The path in Exec= needs to be absolute for KWin to validate it.

On Fri, Oct 4, 2024 at 6:02 PM rahul vadhyar <vadhyarrahul at gmail.com> wrote:
>
> After trying copying code in xdg-desktop-portal-kde, I am now presented with
> The process is not authorized to take a screenshot
>
>  From my research(https://phabricator.kde.org/D29407, https://forum.kde.org/viewtopic.php%3Ff=305&t=176422.html), it should have been fixed by putting the app in a root write only dir. But even after putting the app in /usr/bin and the .desktop file in /usr/share/applications, I still cannot get rid of this error.
>
> I am providing my .desktop file as reference if that helps.
> [Desktop Entry]
> Name=Kool Intelligence
> Exec=koolintelligence
> Icon=kde
> Type=Application
> Terminal=false
> Categories=System
> X-DBUS-ServiceName=org.kde.koolintelligence
> X-KDE-DBUS-Restricted-Interfaces=org.kde.kwin.Screenshot,org.kde.KWin.ScreenShot2
>
> Sorry for asking every small thing, I am new to this, and the lack of documentation around this leaves me no option.
> Please help me solve this (hopefully) final error.
>
> A very heartfelt thanks for your support,
> Rahul
>
> On Fri, 4 Oct 2024 at 20:20, Vlad Zahorodnii <vlad.zahorodnii at kde.org> wrote:
>>
>> On 10/4/24 5:28 PM, rahul vadhyar wrote:
>> > Even if CaptureWorkspace returns a dictionary, I shouldn't be getting
>> > the error that the API doesn't exist.
>>
>> I think that the error message is rather misleading. CaptureWorkspace
>> expects some input arguments, but the example code provides none so
>> QtDBus says that there's no CaptureWorkspace **with the specified**
>> signature.
>>
>> CaptureWorkspace expects two arguments: a dictionary with various
>> options (it can be empty), and a pipe file descriptor where kwin will
>> write screenshot to. A good example how to use that API is spectacle or
>> xdg-desktop-portal-kde
>> https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/30b9ac6a169ee9f7c36aabbec4038a8a715ac2cb/src/screenshotdialog.cpp#L158
>>
>> > To provide more context, I am making a kirigami app. I am using the
>> > .desktop file as given in the previous email. I am also using the
>> > following command for compiling and testing


More information about the kwin mailing list