Bug 381160 - Battery plasmoid does not show a notification that an application is inhibiting screenlock when it uses xdg-screensaver to do so
Summary: Battery plasmoid does not show a notification that an application is inhibiti...
Status: RESOLVED UPSTREAM
Alias: None
Product: plasmashell
Classification: Plasma
Component: Battery Monitor (show other bugs)
Version: 5.10.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords:
: 383296 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-13 15:09 UTC by Kishore Gopalakrishnan
Modified: 2017-08-10 00:25 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot showing the message expected (18.96 KB, image/png)
2017-06-13 15:09 UTC, Kishore Gopalakrishnan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2017-06-13 15:09:22 UTC
Created attachment 106078 [details]
Screenshot showing the message expected

Some media players (e.g. VLC) inhibit power management when a video is being played. In such instances, a notification (see attached screenshot) is shown in the 'battery and brightness' plasmoid that the application is disabling power management. 

MPV media player calls xdg-screensaver to inhibit the lockscreen (See https://github.com/mpv-player/mpv/issues/3801 ), and when it does so, it is able to inhibit suspend, but there is no message to that effect in the battery and brightness plasmoid. 

Steps to reproduce:
Play a video in mpv.

Actual result:
Power management is inhibited (one can check this by playing a video after setting the screenlock timeout to, for e.g., 1 min), but the 'battery and brightness' plasmoid does not show any message informing the user of this.

Expected result:
The battery and brightness plasmoid should show a message even for applications which call xdg-screensaver to inhibit power management.
Comment 1 Kai Uwe Broulik 2017-06-14 14:21:14 UTC
When I run xdg-screensaver from console I can see it telling org.freedesktop.ScreenSaver on DBus which in turn tells PowerDevil.  Then it immediately uninhibits because the application (xdg-screensaver) that requested the inhibition quit.

powerdevil: Scheduling inhibition from ":1.10" "0x5a00005" with cookie 1 and reason "xdg-screensaver"
powerdevil: Releasing inhibition with cookie  1

I don't actually have mpv installed here, so I don't know if this behavior applies to it at all. I just don't understand why the inhibition still holds after it, screen locker also uninhibits in this case. Are you sure the inhibition is applied? Perhaps it's doing another thing (simulate user activity) repeatedly.

In any case the "appName" which is ":1.10" with reason "xdg-screensaver" is just plain wrong and perhaps that causes the issue of it not showing up, ":1.10" is not a valid application name after all.
Comment 2 Kishore Gopalakrishnan 2017-06-14 16:25:50 UTC
(In reply to Kai Uwe Broulik from comment #1)
> When I run xdg-screensaver from console I can see it telling
> org.freedesktop.ScreenSaver on DBus which in turn tells PowerDevil.  Then it
> immediately uninhibits because the application (xdg-screensaver) that
> requested the inhibition quit.
> 
> powerdevil: Scheduling inhibition from ":1.10" "0x5a00005" with cookie 1 and
> reason "xdg-screensaver"
> powerdevil: Releasing inhibition with cookie  1
> 
> I don't actually have mpv installed here, so I don't know if this behavior
> applies to it at all. I just don't understand why the inhibition still holds
> after it, screen locker also uninhibits in this case. Are you sure the
> inhibition is applied? Perhaps it's doing another thing (simulate user
> activity) repeatedly.
> 
> In any case the "appName" which is ":1.10" with reason "xdg-screensaver" is
> just plain wrong and perhaps that causes the issue of it not showing up,
> ":1.10" is not a valid application name after all.

It seems mpv calls 'xdg-screensaver reset' at regular intervals (https://github.com/mpv-player/mpv/issues/3851).

However, as a test, I got the window ID of my konsole window using 'xwininfo', and then ran 'xdg-screensaver suspend 0x3800006' (0x3800006 was the window ID). I was still not able to see any notification in the battery monitor plasmoid or any new messages in my system logs (running 'journalctl -f').
Comment 3 David Edmundson 2017-08-09 00:14:26 UTC
*** Bug 383296 has been marked as a duplicate of this bug. ***
Comment 4 David Edmundson 2017-08-09 00:19:14 UTC
xdg-screensaver is a script that does different things for each desktop.

The one that tries to use the standard fd.o interface is just completely wrong.

From the spec:
"Inhibition will stop when the UnInhibit function is called, or the application disconnects from the D-Bus session bus (which usually happens upon exit)."
https://people.freedesktop.org/~hadess/idle-inhibition-spec/ch03.html


dbus-send (called from the xdg-screensaver script) exits immediately after sending

We follow the fd.o spec so correctly remove the inhibition.

xdg-screensaver needs fixing, not plasma.

Please report to freedesktop.org

(FWIW, code to xdg-screensaver is here: https://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-screensaver.in)
Comment 5 Kishore Gopalakrishnan 2017-08-09 01:03:14 UTC
(In reply to David Edmundson from comment #4)
> xdg-screensaver is a script that does different things for each desktop.
> 
> The one that tries to use the standard fd.o interface is just completely
> wrong.
> 
> From the spec:
> "Inhibition will stop when the UnInhibit function is called, or the
> application disconnects from the D-Bus session bus (which usually happens
> upon exit)."
> https://people.freedesktop.org/~hadess/idle-inhibition-spec/ch03.html
> 
> 
> dbus-send (called from the xdg-screensaver script) exits immediately after
> sending
> 
> We follow the fd.o spec so correctly remove the inhibition.
> 
> xdg-screensaver needs fixing, not plasma.
> 
> Please report to freedesktop.org
> 
> (FWIW, code to xdg-screensaver is here:
> https://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-screensaver.in)

I've reported the bug here (https://bugs.freedesktop.org/show_bug.cgi?id=102124), but since I don't know much about the issue, I just copied your comment #4 from above. Could you please add a comment there in case I've missed any relevant information?