elementary / wingpanel-indicator-power

Wingpanel Power Indicator
GNU General Public License v3.0
25 stars 15 forks source link

AppList: Don't show the power eater section if failed to get the app #226

Closed ryonakano closed 2 years ago

ryonakano commented 2 years ago

Merge #225 first!

It seems like power_eater.application.get_desktop_file () can return null if the desktop file is unavailable. For me, this happens when running several virtual machines on VirtualBox. And in this case (when the desktop file is unavailable), the power eater section in the Power Indicator only shows the header and blank rows:

Screenshot from 2022-03-09 09-36-53

This PR fixes this strange behavior. If the desktop file is unavailable and can't show any apps, simply hide the header itself too, by counting the actual number of the AppRows, instead of the number of the power eaters (which could include apps whose desktop file is available).

ryonakano commented 2 years ago

Yeah it would be better if we can get the app info other than from desktop files as a fallback.

GNOME seems to handling this thing well; The label of the menubar says "VirtualBox Machine" in the same situation:

Screenshot from 2022-03-11 11-58-14

jeremypw commented 2 years ago

We can leave providing a fallback to another PR. Thanks!