Bug 449635 - Battery applet doesn't list apps inhibiting sleep.
Summary: Battery applet doesn't list apps inhibiting sleep.
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: DataEngines (other bugs)
Version First Reported In: 5.23.90
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-05 01:22 UTC by Lemuel Simon
Modified: 2022-02-08 16:10 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24.0
Sentry Crash Report:


Attachments
Vivaldi playing music, inhibiting sleep, doesn't appear in applet. (546.46 KB, image/png)
2022-02-05 01:25 UTC, Lemuel Simon
Details
ListInhibitions dbus method (123.95 KB, image/png)
2022-02-05 04:07 UTC, Lemuel Simon
Details
ListInhibitions dbus method (fake inhibitor 'foo' 'bar') (110.09 KB, image/png)
2022-02-05 04:12 UTC, Lemuel Simon
Details
Plasma Engine Explorer, Inhibitions data source doesn't expand. (63.00 KB, image/png)
2022-02-05 12:31 UTC, Lemuel Simon
Details
Vivaldi playing Youtube video, inhibiting sleep, shown in 'Display Configuration' applet. (412.87 KB, image/png)
2022-02-07 00:26 UTC, Lemuel Simon
Details
«Display Configuration» and «Battery and Brightness» applets are fine (107.75 KB, image/png)
2022-02-07 01:16 UTC, ratijas
Details
PowerManagementItem.qml for Plasma 5.23.90 (4.02 KB, text/x-qml)
2022-02-07 01:59 UTC, Lemuel Simon
Details
Battery and Brightness applet show sleep inhibiting apps again. (697.31 KB, image/png)
2022-02-08 16:03 UTC, Lemuel Simon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lemuel Simon 2022-02-05 01:22:10 UTC
SUMMARY
As of Plasma 5.23.90, the battery applet will no longer list the applications inhibiting sleep or the screen timeout, although the inhibitors work. The feature worked in 5.23, so I think it may be a regression. 

STEPS TO REPRODUCE
1. Open Retroarch/MPV/Dragonplayer/Youtube in Chrome
2. Play media (games/videos)
3. Open battery applet in Plasma Panel or Latte Dock.

OBSERVED RESULT
The applications inhibiting sleep are not listed in the battery applet anymore. However, sleep is inhibited by the applications as they normally would.

EXPECTED RESULT
Chromium/Retroarch/Dragonplayer would be listed in the battery applet if something is playing.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Leap 15.3
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.3.18-150300.59.43-default (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i5-3320M CPU @ 2.60GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000
Comment 1 Lemuel Simon 2022-02-05 01:25:48 UTC
Created attachment 146290 [details]
Vivaldi playing music, inhibiting sleep, doesn't appear in applet.
Comment 2 ratijas 2022-02-05 01:47:03 UTC
I suppose this was fixed in https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1377

Apart from that, it also happens to my laptop that after waking up from sleep Plasma's data engine doesn't get any inhibitions to list. The problem might be in the integration glue or in the underlying D-Bus services.

When you think inhibitions do exist but are not listed, please post screenshots of the following:
- open of Plasma Engine Explorer with "powermanagement" data engine selected, request/update "Inhibitions" data source and expand it in tree view;
- open Qt D-Bus Viewer, then:
  * switch to Session Bus tab;
  * search for org.freedesktop.PowerManagement.Inhibit service;
  * in the right pane navigate to object org/kde/Solid/PowerManagement/PolicyAgent
  * expand the org.kde.Solid.PowerManagement.PolicyAgent interface (the one with italic font)
  * click on ListInhibitions method.
  * for testing purposes, click on AddInhibition method, enter any non-empty string in second and third arguments (app id and reason), and click OK. Few seconds later verify that inhibition this 'fake' inhibition should appear in the ListInhibitions's output.
Comment 3 Lemuel Simon 2022-02-05 04:07:21 UTC
Created attachment 146293 [details]
ListInhibitions dbus method

ListInhibitions method successfully shows Vivaldi (web browser) inhibit sleep while playing a video.
Comment 4 Lemuel Simon 2022-02-05 04:12:51 UTC
Created attachment 146294 [details]
ListInhibitions dbus method (fake inhibitor 'foo' 'bar')

The fake inhibitor shows up in Dbus Viewer as well. Still isn't reflected in the battery applet.
Comment 5 Lemuel Simon 2022-02-05 12:31:25 UTC
Created attachment 146309 [details]
Plasma Engine Explorer, Inhibitions data source doesn't expand.

I've just realized that this was to be done in Plasma Engine Explorer than Qt5 Dbus Viewer. My apologies.
Comment 6 ratijas 2022-02-05 13:07:47 UTC
> I've just realized that this was to be done in Plasma Engine Explorer than Qt5 Dbus Viewer. My apologies.

I was asking for both, so you did everything right. Thank you!

> Plasma Engine Explorer, Inhibitions data source doesn't expand.

Just to clarify: I see you typed in "Inhibitions" in the source name, so I assume you explicitly "Request"ed it, and it still does not expand, correct? If so, then it rules out the possibility of a bug in applet frontend, and we gotta investigate data providers.
Comment 7 Lemuel Simon 2022-02-05 13:15:46 UTC
(In reply to ratijas from comment #6)
> > I've just realized that this was to be done in Plasma Engine Explorer than Qt5 Dbus Viewer. My apologies.
> 
> I was asking for both, so you did everything right. Thank you!
> 
> > Plasma Engine Explorer, Inhibitions data source doesn't expand.
> 
> Just to clarify: I see you typed in "Inhibitions" in the source name, so I
> assume you explicitly "Request"ed it, and it still does not expand, correct?
> If so, then it rules out the possibility of a bug in applet frontend, and we
> gotta investigate data providers.

That assumption is correct. I clicked on the entry and it didn't expand, so I tried manually typing it in.
Comment 8 ratijas 2022-02-05 17:04:41 UTC
> That assumption is correct. I clicked on the entry and it didn't expand, so I tried manually typing it in.

Yeah, that's pretty stupid on engine explorer side.  It should provide some UI means to understand that data source is not connected, and show a  "Connect" button instead of requiring manual typing or context menu.

// TODO for myself: overhaul the Plasma Engine Explorer UI/UX
Comment 9 Lemuel Simon 2022-02-07 00:26:59 UTC
Created attachment 146367 [details]
Vivaldi playing Youtube video, inhibiting sleep, shown in 'Display Configuration' applet.

Apparently, this information is shown in the 'Display Configuration' applet instead of the Battery Applet. The 'Wakelock' for Chromium shows up there while playing a video (see screenshot). This may not be a bug after all, but a 'questionable' redesign. I found this out by mistake and Display Configuration applet is not visible by default. It isn't as discoverable as when it was in the Battery Applet.

~~Also, why is Presentation Mode in both the Battery Applet and the Display Configuration applet, but the Wakelock only shown in the latter?~~

Should I close this bug?
Comment 10 ratijas 2022-02-07 00:30:39 UTC
> Display Configuration

I… didn't even knew such applet exists.

> This may not be a bug after all, but a 'questionable' redesign. I found this out by mistake and Display Configuration applet is not visible by default. It isn't as discoverable as when it was in the Battery Applet.

No, I can assure you there were no plans on removing inhibitions from the «Battery and Brightness» applet. This is most certainly a bug is our data sources on backend part.
Comment 11 Lemuel Simon 2022-02-07 00:36:16 UTC
(In reply to ratijas from comment #10)
> No, I can assure you there were no plans on removing inhibitions from the
> «Battery and Brightness» applet. This is most certainly a bug is our data
> sources on backend part.

Then 'Display Configuration' is reading another data source, as in, its not using the backend?
Comment 12 ratijas 2022-02-07 01:16:51 UTC
Created attachment 146372 [details]
«Display Configuration» and «Battery and Brightness» applets are fine

I glanced at Display Configuration applet and its sources. Looks nice, uses the the same "powermanagement" data engine indeed. The code is moderately horrible, and should be fixed just like B&B applet was. Now I see where's that `inhibitions[0]` thing comes from in B&B, huh…

Anyways, works for me (on git master) in both applets just fine, inhibitions are all there. Try building plasma-workspace package from source and see if it helps — are you able to do that without destroying your system?

Or, you know what, let's do this: find the PowerManagementItem.qml file in your system — locate(1) utility is your friend, but usually it should be something like /usr/share/plasma/plasmoids/org.kde.plasma.battery/contents/ui/PowerManagementItem.qml — and upload it here or as a snippet on GitLab, so I can compare which version was that. Since inhibitions are present in your Display Configuration applet (and thus in the data engine), I suspect this is the issue that was already fixed in master.
Comment 13 Lemuel Simon 2022-02-07 01:59:49 UTC
Created attachment 146375 [details]
PowerManagementItem.qml for Plasma 5.23.90

OK, I've attached the requested file. Sorry for the late response.
Comment 14 Nate Graham 2022-02-07 05:15:04 UTC
> No, I can assure you there were no plans on removing inhibitions from the «Battery and Brightness»
> applet. This is most certainly a bug is our data sources on backend part.
What exactly is the bug?
Comment 15 Lemuel Simon 2022-02-08 16:03:59 UTC
Created attachment 146447 [details]
Battery and Brightness applet show sleep inhibiting apps again.

I just updated to Plasma 5.24 today. Sleep inhibiting apps are now listed in the 'Battery and Brightness' applet as it did before. It works as expected, so I'll close the bug. @Ratijas, thanks for looking into the matter. You responses were quick and thorough, highly appreciated.
Comment 16 Lemuel Simon 2022-02-08 16:10:05 UTC
(In reply to Lemuel Simon from comment #15)
> Created attachment 146447 [details]
> Battery and Brightness applet show sleep inhibiting apps again.
> 
> I just updated to Plasma 5.24 today. Sleep inhibiting apps are now listed in
> the 'Battery and Brightness' applet as it did before. It works as expected,
> so I'll close the bug. @Ratijas, thanks for looking into the matter. You
> responses were quick and thorough, highly appreciated.

Uhh...I'm second-guessing here. Applets work but Plasma Engine Explorer still shows nothing if the Inhibitions data source is selected under Power Management. Separate issues, yeah?