[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Using xdg-desktop-portal-kde to take screenshots
From:       Damir Porobic <damir_porobic () live ! com>
Date:       2020-09-27 8:03:17
Message-ID: AM0PR09MB38904FFAD806E695B1153C3FE5340 () AM0PR09MB3890 ! eurprd09 ! prod ! outlook ! com
[Download RAW message or body]

I have had a look at the dbus monitor and this is what I see after hitting the save \
button in the dialog:

**************************
signal time=1601192691.549507 sender=:1.17 -> destination=(null destination) \
serial=55 path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged  \
int32 3 signal time=1601192691.559384 sender=:1.17 -> destination=(null destination) \
serial=56 path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged  \
int32 0 method return time=1601192691.738677 sender=:1.58 -> destination=:1.53 \
serial=36 reply_serial=141  uint32 0
   array [
      dict entry(
         string "uri"
         variant             string \
"file:///home/dporobic/Screenshot_20200927_094451.png"  )
   ]
signal time=1601192691.739126 sender=:1.53 -> destination=:1.50 serial=143 \
path=/org/freedesktop/portal/desktop/request/1_50/u3; \
interface=org.freedesktop.portal.Request; member=Response  uint32 0
   array [
      dict entry(
         string "uri"
         variant             string \
"file:///home/dporobic/Screenshot_20200927_094451.png"  )
   ]
method call time=1601192691.739267 sender=:1.53 -> destination=org.freedesktop.DBus \
serial=144 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=RemoveMatch  string \
"type='signal',sender='org.freedesktop.impl.portal.desktop.kde',interface='org.freedes \
ktop.DBus.Properties',member='PropertiesChanged',path='/org/freedesktop/portal/desktop/request/1_50/u3',arg0='org.freedesktop.impl.portal.Request'"
 method return time=1601192691.739275 sender=org.freedesktop.DBus -> \
destination=:1.53 serial=116 reply_serial=144 method call time=1601192691.739308 \
sender=:1.53 -> destination=org.freedesktop.DBus serial=145 \
path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch  \
string "type='signal',sender='org.freedesktop.impl.portal.desktop.kde',interface='org. \
freedesktop.impl.portal.Request',path='/org/freedesktop/portal/desktop/request/1_50/u3'"
 method return time=1601192691.739317 sender=org.freedesktop.DBus -> \
destination=:1.53 serial=117 reply_serial=145 signal time=1601192692.064469 \
sender=:1.6 -> destination=(null destination) serial=206 path=/; \
interface=org.kde.KDirNotify; member=FilesAdded  string "desktop:/"
signal time=1601192692.064637 sender=:1.6 -> destination=(null destination) \
serial=207 path=/; interface=org.kde.KDirNotify; member=FilesAdded  string \
"desktop:/Screenshot_20200927_094451.png" signal time=1601192692.064789 sender=:1.6 \
-> destination=(null destination) serial=208 path=/; interface=org.kde.KDirNotify; \
member=FilesAdded  string "desktop:/"
method call time=1601192692.071804 sender=:1.60 -> destination=org.freedesktop.DBus \
serial=15 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch \
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'"
 method call time=1601192692.071946 sender=:1.60 -> destination=org.freedesktop.DBus \
serial=16 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=GetNameOwner  string "org.kde.kded5"
method return time=1601192692.071974 sender=org.freedesktop.DBus -> destination=:1.60 \
serial=9 reply_serial=16  string ":1.6"
method call time=1601192692.072129 sender=:1.60 -> destination=org.kde.kded5 \
serial=17 path=/modules/desktopnotifier; interface=org.kde.DesktopNotifier; \
member=watchDir  string "/home/dporobic"
method call time=1601192692.072140 sender=:1.60 -> destination=org.freedesktop.DBus \
serial=18 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=RemoveMatch  string \
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'"
 method call time=1601192692.082794 sender=:1.60 -> destination=org.freedesktop.DBus \
serial=19 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch \
string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'"
 method call time=1601192692.082901 sender=:1.60 -> destination=org.freedesktop.DBus \
serial=20 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=GetNameOwner  string "org.kde.kded5"
method return time=1601192692.082918 sender=org.freedesktop.DBus -> destination=:1.60 \
serial=10 reply_serial=20  string ":1.6"
method call time=1601192692.083083 sender=:1.60 -> destination=org.kde.kded5 \
serial=21 path=/modules/desktopnotifier; interface=org.kde.DesktopNotifier; \
member=watchDir  string "/home/dporobic"
method call time=1601192692.083099 sender=:1.60 -> destination=org.freedesktop.DBus \
serial=22 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=RemoveMatch  string \
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'"
 signal time=1601192696.749626 sender=:1.17 -> destination=(null destination) \
serial=57 path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged  \
int32 4 signal time=1601192696.749779 sender=:1.17 -> destination=(null destination) \
serial=58 path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged  \
int32 0

**************************

And this is what my application console output spits out:

**************************
Got reply
The path: /org/freedesktop/portal/desktop/request/1_50/u3
**************************

The call seems to be correct I guess. Any idea?

Regards,
Damir

________________________________
From: Damir Porobic <damir_porobic@live.com>
Sent: Monday, September 21, 2020 10:31
To: kde-devel@kde.org <kde-devel@kde.org>
Subject: Re: Using xdg-desktop-portal-kde to take screenshots

When you run "dbus-monitor --session" and you perform the screenshot, do you see this \
signal to be called at all?

Thanks Jan, I'll try that.

Unfortunately no, again a limitation of the portal API as the portal is supposed to \
return an URI. You can however directly use KWin DBus interface to get a screenshot, \
specifying directly what type of screenshot you want to tak and you get the raw \
image. This however will make it work only in Plasma and will not work in an \
application running in sandbox without giving it access to DBus. My Application \
already supports native Plasma and Gnome Wayland Screenshots, but that does don't \
work if the application is packaged as Snap or when non Plasma or Gnome environments \
are used, so I'm trying to make this generic  Wayland solution work.

Also, I've been playing around with this under Gnome too and they have also a Dialog \
but with a Share button instead of Save. I believe they are doing it like with the \
native Wayland solution by saving the image in a temp directory that is deleted on \
reboot and just providing the path to the image. The user can decide what to do with \
the image, save it permanently or do nothing and the image is gone. Though there I \
have the same problem that the gotScreenshotResponse is never called.

Best regards,
Damir

________________________________
From: kde-devel <kde-devel-bounces@kde.org> on behalf of Jan Grulich \
                <jgrulich@redhat.com>
Sent: Monday, September 21, 2020 08:08
To: kde-devel@kde.org <kde-devel@kde.org>
Subject: Re: Using xdg-desktop-portal-kde to take screenshots

Hi,

ne 20. 9. 2020 v 18:37 odesílatel Damir Porobic \
<damir_porobic@live.com<mailto:damir_porobic@live.com>> napsal: Hello Jan,

finally I  found some time to upgrade my OS and got a newer Plasma Version but I'm \
still struggling with the Screenshot Portal.

Here is my implementation, almost identical to yours from the test that you have \
linked me (pasting here only the relevant methods):I get the dialog which asks me \
what type of screenshot I want to take I select it, a small image is show in the \
dialog and I can click on save (which saves the image in my home directory) but the \
gotScreenshotResponse is never called. Any idea why?

I have no idea. The code looks good and identical to what I have in the example. When \
you run "dbus-monitor --session" and you perform the screenshot, do you see this \
signal to be called at all?

Can I tell the dialog where to save those images?

Unfortunately no, I made it very basic, but patches are welcomed, it won't be a hard \
task to implement it.

Can I tell the dialog right away what type of screenshot I want to take?

Unfortunately no, this is not supported by the portal API.

Can I just share the screenshot with my application without saving it?

Unfortunately no, again a limitation of the portal API as the portal is supposed to \
return an URI. You can however directly use KWin DBus interface to get a screenshot, \
specifying directly what type of screenshot you want to tak and you get the raw \
image. This however will make it work only in Plasma and will not work in an \
application running in sandbox without giving it access to DBus.

Regards,
Jan


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div>
<div id="appendonsend" style="font-family: Calibri, Helvetica, sans-serif; font-size: \
12pt; color: rgb(0, 0, 0);"> I have had a look at the dbus monitor and this is what I \
see after hitting the save button in the dialog:</div> <div style="font-family: \
Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
                rgb(0, 0, 0);">
**************************<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <span style="font-family: Consolas, Courier, monospace;">signal \
time=1601192691.549507 sender=:1.17 -&gt; destination=(null destination) serial=55 \
path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged</span> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;int32 \
3</span></div> <div><span style="font-family: Consolas, Courier, monospace;">signal \
time=1601192691.559384 sender=:1.17 -&gt; destination=(null destination) serial=56 \
path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;int32 \
0</span></div> <div><span style="font-family: Consolas, Courier, monospace;">method \
return time=1601192691.738677 sender=:1.58 -&gt; destination=:1.53 serial=36 \
reply_serial=141</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;uint32 0</span></div> <div><span style="font-family: \
Consolas, Courier, monospace;">&nbsp; &nbsp;array [</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp; &nbsp; dict \
entry(</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string &quot;uri&quot;</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp;variant &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string \
&quot;file:///home/dporobic/Screenshot_20200927_094451.png&quot;</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp; &nbsp; \
)</span></div> <div><span style="font-family: Consolas, Courier, monospace;">&nbsp; \
&nbsp;]</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">signal time=1601192691.739126 sender=:1.53 -&gt; destination=:1.50 \
serial=143 path=/org/freedesktop/portal/desktop/request/1_50/u3; \
interface=org.freedesktop.portal.Request; member=Response</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;uint32 0</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;array \
[</span></div> <div><span style="font-family: Consolas, Courier, monospace;">&nbsp; \
&nbsp; &nbsp; dict entry(</span></div> <div><span style="font-family: Consolas, \
Courier, monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string \
&quot;uri&quot;</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;variant &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; string \
&quot;file:///home/dporobic/Screenshot_20200927_094451.png&quot;</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp; &nbsp; \
)</span></div> <div><span style="font-family: Consolas, Courier, monospace;">&nbsp; \
&nbsp;]</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">method call time=1601192691.739267 sender=:1.53 -&gt; \
destination=org.freedesktop.DBus serial=144 path=/org/freedesktop/DBus; \
interface=org.freedesktop.DBus; member=RemoveMatch</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;type='signal',sender='org.freedesktop.impl.portal.desktop.kde',interface='org.fr \
eedesktop.DBus.Properties',member='PropertiesChanged',path='/org/freedesktop/portal/de \
sktop/request/1_50/u3',arg0='org.freedesktop.impl.portal.Request'&quot;</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">method return \
time=1601192691.739275 sender=org.freedesktop.DBus -&gt; destination=:1.53 serial=116 \
reply_serial=144</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">method call time=1601192691.739308 sender=:1.53 -&gt; \
destination=org.freedesktop.DBus serial=145 path=/org/freedesktop/DBus; \
interface=org.freedesktop.DBus; member=RemoveMatch</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;type='signal',sender='org.freedesktop.impl.portal.desktop.kde',interface='org.fr \
eedesktop.impl.portal.Request',path='/org/freedesktop/portal/desktop/request/1_50/u3'&quot;</span></div>
 <div><span style="font-family: Consolas, Courier, monospace;">method return \
time=1601192691.739317 sender=org.freedesktop.DBus -&gt; destination=:1.53 serial=117 \
reply_serial=145</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">signal time=1601192692.064469 sender=:1.6 -&gt; destination=(null \
destination) serial=206 path=/; interface=org.kde.KDirNotify; \
member=FilesAdded</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;string &quot;desktop:/&quot;</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">signal time=1601192692.064637 \
sender=:1.6 -&gt; destination=(null destination) serial=207 path=/; \
interface=org.kde.KDirNotify; member=FilesAdded</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;desktop:/Screenshot_20200927_094451.png&quot;</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">signal time=1601192692.064789 \
sender=:1.6 -&gt; destination=(null destination) serial=208 path=/; \
interface=org.kde.KDirNotify; member=FilesAdded</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;desktop:/&quot;</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">method call time=1601192692.071804 sender=:1.60 -&gt; \
destination=org.freedesktop.DBus serial=15 path=/org/freedesktop/DBus; \
interface=org.freedesktop.DBus; member=AddMatch</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'&quot;</span></div>
 <div><span style="font-family: Consolas, Courier, monospace;">method call \
time=1601192692.071946 sender=:1.60 -&gt; destination=org.freedesktop.DBus serial=16 \
path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=GetNameOwner</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;string &quot;org.kde.kded5&quot;</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">method return \
time=1601192692.071974 sender=org.freedesktop.DBus -&gt; destination=:1.60 serial=9 \
reply_serial=16</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;string &quot;:1.6&quot;</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">method call time=1601192692.072129 \
sender=:1.60 -&gt; destination=org.kde.kded5 serial=17 path=/modules/desktopnotifier; \
interface=org.kde.DesktopNotifier; member=watchDir</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;/home/dporobic&quot;</span></div> <div><span style="font-family: Consolas, \
Courier, monospace;">method call time=1601192692.072140 sender=:1.60 -&gt; \
destination=org.freedesktop.DBus serial=18 path=/org/freedesktop/DBus; \
interface=org.freedesktop.DBus; member=RemoveMatch</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'&quot;</span></div>
 <div><span style="font-family: Consolas, Courier, monospace;">method call \
time=1601192692.082794 sender=:1.60 -&gt; destination=org.freedesktop.DBus serial=19 \
path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=AddMatch</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;string \
&quot;type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'&quot;</span></div>
 <div><span style="font-family: Consolas, Courier, monospace;">method call \
time=1601192692.082901 sender=:1.60 -&gt; destination=org.freedesktop.DBus serial=20 \
path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; \
member=GetNameOwner</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;string &quot;org.kde.kded5&quot;</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">method return \
time=1601192692.082918 sender=org.freedesktop.DBus -&gt; destination=:1.60 serial=10 \
reply_serial=20</span></div> <div><span style="font-family: Consolas, Courier, \
monospace;">&nbsp; &nbsp;string &quot;:1.6&quot;</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">method call time=1601192692.083083 \
sender=:1.60 -&gt; destination=org.kde.kded5 serial=21 path=/modules/desktopnotifier; \
interface=org.kde.DesktopNotifier; member=watchDir</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;/home/dporobic&quot;</span></div> <div><span style="font-family: Consolas, \
Courier, monospace;">method call time=1601192692.083099 sender=:1.60 -&gt; \
destination=org.freedesktop.DBus serial=22 path=/org/freedesktop/DBus; \
interface=org.freedesktop.DBus; member=RemoveMatch</span></div> <div><span \
style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;string \
&quot;type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.kde.kded5'&quot;</span></div>
 <div><span style="font-family: Consolas, Courier, monospace;">signal \
time=1601192696.749626 sender=:1.17 -&gt; destination=(null destination) serial=57 \
path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;int32 \
4</span></div> <div><span style="font-family: Consolas, Courier, monospace;">signal \
time=1601192696.749779 sender=:1.17 -&gt; destination=(null destination) serial=58 \
path=/scheduler; interface=org.kde.baloo.scheduler; member=stateChanged</span></div> \
<div><span style="font-family: Consolas, Courier, monospace;">&nbsp; &nbsp;int32 \
0</span></div> <br>
**************************</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> And this is what my application console output spits out:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
                rgb(0, 0, 0);">
**************************<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <span style="font-family: Consolas, Courier, monospace;">Got \
reply</span> <div><span style="font-family: Consolas, Courier, monospace;">The path: \
                /org/freedesktop/portal/desktop/request/1_50/u3</span></div>
**************************<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> The call seems to be correct I guess. Any idea? <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> Regards,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> Damir<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, \
sans-serif" color="#000000"><b>From:</b> Damir Porobic \
&lt;damir_porobic@live.com&gt;<br> <b>Sent:</b> Monday, September 21, 2020 10:31<br>
<b>To:</b> kde-devel@kde.org &lt;kde-devel@kde.org&gt;<br>
<b>Subject:</b> Re: Using xdg-desktop-portal-kde to take screenshots</font>
<div>&nbsp;</div>
</div>
<div dir="ltr">
<blockquote style="border-left:3px solid rgb(200,200,200); \
border-top-color:rgb(200,200,200); border-right-color:rgb(200,200,200); \
border-bottom-color:rgb(200,200,200); padding-left:1ex; margin-left:0.8ex; \
color:rgb(102,102,102)"> <div style="font-family:Calibri,Helvetica,sans-serif; \
font-size:12pt; color:rgb(0,0,0)"> When you run &quot;dbus-monitor --session&quot; \
and you perform the screenshot, do you see this signal to be called at all?<br> \
</div> </blockquote>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Thanks Jan, I'll try that.&nbsp;</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <br>
</div>
<blockquote style="border-left:3px solid rgb(200,200,200); \
border-top-color:rgb(200,200,200); border-right-color:rgb(200,200,200); \
border-bottom-color:rgb(200,200,200); padding-left:1ex; margin-left:0.8ex; \
color:rgb(102,102,102)"> <div style="font-family:Calibri,Helvetica,sans-serif; \
font-size:12pt; color:rgb(0,0,0)"> <span style="font-size:14px; \
background-color:rgb(255,255,255); display:inline!important">Unfortunately no, again \
a limitation of the portal API as the portal is supposed to return an URI. You can \
however directly use KWin DBus interface to get a screenshot,  specifying directly \
what type of screenshot you want to tak and you get the raw image. This however will \
make it work only in Plasma and will not work in an application running in sandbox \
without giving it access to DBus.&nbsp;</span></div> </blockquote>
<div style=""><font color="#000000"><span style="font-size:14px">My Application \
already supports native&nbsp;Plasma and Gnome Wayland Screenshots, but that does \
don't work if the application is packaged as Snap or when non Plasma or Gnome \
environments are used,  so I'm trying to make this generic&nbsp; Wayland solution \
work.</span></font></div> <div style=""><font color="#000000"><span \
style="font-size:14px"><br> </span></font></div>
<div style=""><font color="#000000"><span style="font-size:14px">Also, I've been \
playing around with this under Gnome too and they have also a Dialog but with a Share \
button instead of Save. I believe they are doing it like with the native Wayland \
solution  by saving the image in a temp directory that is deleted on reboot and just \
providing the path to the image. The user can decide what to do with the image, save \
it permanently or do nothing and the image is gone. Though there I have the same \
problem that the&nbsp;gotScreenshotResponse  is never \
called.&nbsp;</span></font></div> <div style=""><font color="#000000"><span \
style="font-size:14px"><br> </span></font></div>
<div style=""><font color="#000000"><span style="font-size:14px">Best \
regards,</span></font></div> <div style=""><font color="#000000"><span \
style="font-size:14px">Damir</span></font></div> <div>
<div id="x_appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, \
sans-serif" color="#000000"><b>From:</b> kde-devel &lt;kde-devel-bounces@kde.org&gt; \
on behalf of Jan Grulich &lt;jgrulich@redhat.com&gt;<br> <b>Sent:</b> Monday, \
September 21, 2020 08:08<br> <b>To:</b> kde-devel@kde.org \
&lt;kde-devel@kde.org&gt;<br> <b>Subject:</b> Re: Using xdg-desktop-portal-kde to \
take screenshots</font> <div>&nbsp;</div>
</div>
<div>
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
<div class="x_x_gmail_quote">
<div dir="ltr" class="x_x_gmail_attr">ne 20. 9. 2020 v&nbsp;18:37 odesílatel Damir \
Porobic &lt;<a href="mailto:damir_porobic@live.com">damir_porobic@live.com</a>&gt; \
napsal:<br> </div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px \
solid rgb(204,204,204); padding-left:1ex"> <div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Hello Jan,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> finally I&nbsp; found some time to upgrade my OS and got a newer \
Plasma Version but I'm still struggling with the Screenshot Portal.</div> <div \
style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)"> \
<br> </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Here is my implementation, almost identical to yours from the test \
that you have linked me (pasting here only the relevant methods):<span \
style="font-size:12pt">I get the dialog which asks me what type of screenshot I want \
to take I select it, a small image  is show in the dialog and I can click on save \
(which saves the image in my home directory) but the gotScreenshotResponse is never \
called. Any idea why?</span></div> </div>
</blockquote>
<div><br>
</div>
<div>I have no idea. The code looks good and identical to what I have in the example. \
When you run &quot;dbus-monitor --session&quot; and you perform the screenshot, do \
you see this signal to be called at all?</div> <div>&nbsp;</div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px \
solid rgb(204,204,204); padding-left:1ex"> <div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Can I tell the dialog where to save those images?&nbsp;</div>
</div>
</blockquote>
<div><br>
</div>
<div>Unfortunately no, I made it very basic, but patches are welcomed, it won't be a \
hard task to implement it.</div> <div>&nbsp;</div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px \
solid rgb(204,204,204); padding-left:1ex"> <div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Can I tell the dialog right away what type of screenshot I want to \
take?</div> </div>
</blockquote>
<div><br>
</div>
<div>Unfortunately no, this is not supported by the portal API.</div>
<div>&nbsp;</div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px \
solid rgb(204,204,204); padding-left:1ex"> <div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> Can I just share the screenshot with my application without saving \
it?&nbsp;</div> <div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; \
color:rgb(0,0,0)"> <span style="font-family:Arial,Helvetica,sans-serif; \
font-size:small; color:rgb(34,34,34)"></span></div> </div>
</blockquote>
<div><br>
</div>
<div>Unfortunately no, again a limitation of the portal API as the portal is supposed \
to return an URI. You can however directly use KWin DBus interface to get a \
screenshot, specifying directly what type of screenshot you want to tak and you get \
the raw image.  This however will make it work only in Plasma and will not work in an \
application running in sandbox without giving it access to DBus.</div> \
<div>&nbsp;</div> <div>Regards,</div>
<div>Jan</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic