Re: Help with screenshot API.

rahul vadhyar <[email protected]> Fri, 4 Oct 2024 21:32:33 +0530
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <CAOL1oibbQs8O+Maxgh-WV6Kd0_a3DY17w2p3PPd4+srn_S06KQ@mail.gmail.com>
--000000000000478a0b0623a8cd31
Content-Type: text/plain; charset="UTF-8"

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 <[email protected]>
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
>

--000000000000478a0b0623a8cd31
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">After trying copying code in xdg-desktop-portal-kde, I am =
now presented with=C2=A0<div><span style=3D"font-family:monospace"><span st=
yle=3D"color:rgb(0,0,0)">The process is not authorized to take a screensh</=
span>ot<br></span></div><div><br></div><div>=C2=A0From my research(<a href=
=3D"https://phabricator.kde.org/D29407">https://phabricator.kde.org/D29407<=
/a>, <a href=3D"https://forum.kde.org/viewtopic.php%3Ff=3D305&amp;t=3D17642=
2.html">https://forum.kde.org/viewtopic.php%3Ff=3D305&amp;t=3D176422.html</=
a>), 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/s=
hare/applications, I still cannot get rid of this error.<br></div><div><br>=
</div><div>I am providing my .desktop file as reference if that helps.=C2=
=A0</div><div>[Desktop Entry]<br>Name=3DKool Intelligence<br>Exec=3Dkoolint=
elligence<br>Icon=3Dkde<br>Type=3DApplication<br>Terminal=3Dfalse<br>Catego=
ries=3DSystem<br>X-DBUS-ServiceName=3Dorg.kde.koolintelligence<br>X-KDE-DBU=
S-Restricted-Interfaces=3Dorg.kde.kwin.Screenshot,org.kde.KWin.ScreenShot2<=
br></div><div><br></div><div>Sorry=C2=A0for asking every small thing, I am =
new to this, and the lack of documentation around this leaves me no option.=
</div><div>Please help me solve this (hopefully) final error.</div><div><br=
></div><div>A very heartfelt thanks for your support,</div><div>Rahul</div>=
</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=
On Fri, 4 Oct 2024 at 20:20, Vlad Zahorodnii &lt;<a href=3D"mailto:vlad.zah=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex">On 10/4/24 5:28 PM, rahul vadhyar w=
rote:<br>
&gt; Even if CaptureWorkspace returns a dictionary, I shouldn&#39;t be gett=
ing <br>
&gt; the error that the API doesn&#39;t exist.<br>
<br>
I think that the error message is rather misleading. CaptureWorkspace <br>
expects some input arguments, but the example code provides none so <br>
QtDBus says that there&#39;s no CaptureWorkspace **with the specified** <br=
>
signature.<br>
<br>
CaptureWorkspace expects two arguments: a dictionary with various <br>
options (it can be empty), and a pipe file descriptor where kwin will <br>
write screenshot to. A good example how to use that API is spectacle or <br=
>
xdg-desktop-portal-kde <br>
<a href=3D"https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/30b9=
ac6a169ee9f7c36aabbec4038a8a715ac2cb/src/screenshotdialog.cpp#L158" rel=3D"=
noreferrer" target=3D"_blank">https://invent.kde.org/plasma/xdg-desktop-por=
tal-kde/-/blob/30b9ac6a169ee9f7c36aabbec4038a8a715ac2cb/src/screenshotdialo=
g.cpp#L158</a><br>
<br>
&gt; To provide more context, I am making a kirigami app. I am using the <b=
r>
&gt; .desktop file as given in the previous email. I am also using the <br>
&gt; following=C2=A0command for compiling and=C2=A0testing<br>
</blockquote></div>

--000000000000478a0b0623a8cd31--