Re: Help with screenshot API.

Aleix Pol <[email protected]> Fri, 4 Oct 2024 23:03:37 +0200
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <CACcA1Ro5RM6OMb9YKC6zumk0oG3N+WiXdOOu71HKL3FWeS+Ojw@mail.gmail.com>
The path in Exec=3D needs to be absolute for KWin to validate it.

On Fri, Oct 4, 2024 at 6:02=E2=80=AFPM rahul vadhyar <[email protected]=
m> wrote:
>
> After trying copying code in xdg-desktop-portal-kde, I am now presented w=
ith
> The process is not authorized to take a screenshot
>
>  From my research(https://phabricator.kde.org/D29407, https://forum.kde.o=
rg/viewtopic.php%3Ff=3D305&t=3D176422.html), it should have been fixed by p=
utting 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 g=
et rid of this error.
>
> I am providing my .desktop file as reference if that helps.
> [Desktop Entry]
> Name=3DKool Intelligence
> Exec=3Dkoolintelligence
> Icon=3Dkde
> Type=3DApplication
> Terminal=3Dfalse
> Categories=3DSystem
> X-DBUS-ServiceName=3Dorg.kde.koolintelligence
> X-KDE-DBUS-Restricted-Interfaces=3Dorg.kde.kwin.Screenshot,org.kde.KWin.S=
creenShot2
>
> Sorry for asking every small thing, I am new to this, and the lack of doc=
umentation 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 <[email protected]> wr=
ote:
>>
>> 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/30b9ac6a169e=
e9f7c36aabbec4038a8a715ac2cb/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