https://bugs.kde.org/show_bug.cgi?id=486506

Jakob Petsovits <jpe...@petsovits.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED

--- Comment #18 from Jakob Petsovits <jpe...@petsovits.com> ---
I ran dbus-monitor to see what's going on. It makes sense now and I've got a
fix. The disconnect is that xdg-desktop-portals-kde receives an `Inhibit`
request with flags 8 from Firefox, which according to the linked docs means
inhibiting "Idle":

https://docs.flatpak.org/en/latest/portal-api-reference.html#gdbus-org.freedesktop.portal.Inhibit

Following that, xdg-desktop-portals-kde calls PowerDevil's `AddInhibition` with
a "policies" argument of value 1, a.k.a. "InterruptSession". PowerDevil
receives and registers it as requested. You'd think that this would keep the
locker from firing? No, in fact, what "InterruptSession" does is to prevent
sleep, not idle. The XDG portals API has a different flag for that, called
"Suspend" with value 4, not 8.

Hence the fix is to ask PowerDevil for the correct policy, confusingly called
"ChangeScreenSettings" with value 4, not 1. We're already using this for logind
"idle" inhibitors, so I'm pretty confident that it's the right pick also for
portals "Idle".

This also explains why the applet was showing an indicator: PowerDevil was in
fact inhibiting, except not against screen locking but merely against system
sleep.

Here's the relevant dbus-monitor output for reference, from Firefox registering
the inhibition to PowerDevil receiving it:

method call time=1722263501.828060 sender=:1.262 -> destination=:1.6 serial=263
path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Inhibit;
member=Inhibit
   string "org.mozilla.firefox"
   uint32 8
   array [
      dict entry(
         string "reason"
         variant             string "video-playing"
      )
   ]
method call time=1722263501.828599 sender=:1.6 ->
destination=org.freedesktop.DBus serial=9496 path=/org/freedesktop/DBus;
interface=org.freedesktop.DBus; member=AddMatch
   string
"type='signal',sender='org.freedesktop.impl.portal.desktop.kde',interface='org.freedesktop.impl.portal.Request',path='/org/freedesktop/portal/desktop/request/1_262/t/3738610708'"
method return time=1722263501.828618 sender=org.freedesktop.DBus ->
destination=:1.6 serial=4294967295 reply_serial=9496
method call time=1722263501.828625 sender=:1.6 ->
destination=org.freedesktop.DBus serial=9497 path=/org/freedesktop/DBus;
interface=org.freedesktop.DBus; member=StartServiceByName
   string "org.freedesktop.impl.portal.desktop.kde"
   uint32 0
method return time=1722263501.828640 sender=org.freedesktop.DBus ->
destination=:1.6 serial=4294967295 reply_serial=9497
   uint32 2
method call time=1722263501.828871 sender=:1.6 ->
destination=org.freedesktop.DBus serial=9498 path=/org/freedesktop/DBus;
interface=org.freedesktop.DBus; member=GetNameOwner
   string "org.freedesktop.impl.portal.desktop.kde"
method return time=1722263501.828888 sender=org.freedesktop.DBus ->
destination=:1.6 serial=4294967295 reply_serial=9498
   string ":1.31"
method return time=1722263501.829171 sender=:1.6 -> destination=:1.262
serial=9499 reply_serial=263
   object path "/org/freedesktop/portal/desktop/request/1_262/t/3738610708"
method call time=1722263501.829311 sender=:1.6 -> destination=:1.9 serial=9500
path=/org/freedesktop/impl/portal/PermissionStore;
interface=org.freedesktop.impl.portal.PermissionStore; member=Lookup
   string "inhibit"
   string "inhibit"
error time=1722263501.829910 sender=:1.9 -> destination=:1.6
error_name=org.freedesktop.portal.Error.NotFound reply_serial=9500
   string "No entry for inhibit"
method call time=1722263501.830200 sender=:1.6 -> destination=:1.31 serial=9501
path=/org/freedesktop/portal/desktop;
interface=org.freedesktop.impl.portal.Inhibit; member=Inhibit
   object path "/org/freedesktop/portal/desktop/request/1_262/t/3738610708"
   string "org.mozilla.firefox"
   string "org.mozilla.firefox"
   uint32 8
   array [
      dict entry(
         string "reason"
         variant             string "video-playing"
      )
   ]
method call time=1722263501.830491 sender=:1.31 ->
destination=org.kde.Solid.PowerManagement serial=13663
path=/org/kde/Solid/PowerManagement/PolicyAgent;
interface=org.kde.Solid.PowerManagement.PolicyAgent; member=AddInhibition
   uint32 1
   string "org.mozilla.firefox"
   string "video-playing"
method return time=1722263501.830515 sender=:1.31 -> destination=:1.6
serial=13664 reply_serial=9501
method call time=1722263501.830703 sender=:1.272 ->
destination=org.freedesktop.DBus serial=339 path=/org/freedesktop/DBus;
interface=org.freedesktop.DBus; member=AddMatch
   string
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.31',arg2=''"
method return time=1722263501.830924 sender=:1.272 -> destination=:1.31
serial=340 reply_serial=13663
   uint32 9
signal time=1722263501.830937 sender=:1.6 -> destination=:1.262 serial=9502
path=/org/freedesktop/portal/desktop/request/1_262/t/3738610708;
interface=org.freedesktop.portal.Request; member=Response
   uint32 0
   array [
   ]

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to