Bug 494506 - With power profiles not available, battery icon keeps being shown in system tray when fully charged after update to Plasma 6.2.0
Summary: With power profiles not available, battery icon keeps being shown in system t...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power and Battery widget (show other bugs)
Version: 6.2.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-10-11 06:15 UTC by Daniel Hofstetter
Modified: 2025-01-01 00:17 UTC (History)
6 users (show)

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


Attachments
Battery icon in the system tray (2.49 KB, image/png)
2024-10-12 05:28 UTC, Daniel Hofstetter
Details
Battery icon hiding as intended (66.40 KB, image/png)
2024-10-14 23:10 UTC, elydgolden
Details
Battery icon showing even at full charge (76.28 KB, image/png)
2024-10-14 23:10 UTC, elydgolden
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Hofstetter 2024-10-11 06:15:54 UTC
SUMMARY

After updating to Plasma 6.2.0, the battery icon in the system tray is always shown, even when the battery is fully charged and the laptop is plugged in. In previous versions, the battery icon disappeared once the battery was fully charged and the laptop was kept plugged in.

STEPS TO REPRODUCE
1. Set "Shown when relevant" for "Power and battery" in the "System Tray Settings"
2. Fully charge battery

OBSERVED RESULT
Battery icon is shown when the battery is fully charged and the laptop is plugged in.

EXPECTED RESULT
Battery icon disappears once the battery is fully charged and the laptop is plugged in.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.3
Comment 1 Nate Graham 2024-10-11 15:53:41 UTC
Cannot reproduce. Can you attach a screenshot that shows the issue?
Comment 2 Daniel Hofstetter 2024-10-12 05:28:20 UTC
Created attachment 174720 [details]
Battery icon in the system tray

I attached a screenshot, though there is not much to see. It's just that the (fully charged) battery icon is always shown in the system tray if the battery is fully charged and the laptop is plugged in. Previously, the battery icon was not shown in such a case.
Comment 3 elydgolden 2024-10-14 23:08:46 UTC
Can confirm on Plasma 6.2.0 on openSUSE Tumbleweed 20241012. It seems to be inconsistent; sometimes the battery icon hides itself normally other times it shows up, even at 100% full charge. This is all while being set to "shown when relevant" in the system tray. Can't figure out quite yet how to consistently reproduce it
Comment 4 elydgolden 2024-10-14 23:10:25 UTC
Created attachment 174826 [details]
Battery icon hiding as intended
Comment 5 elydgolden 2024-10-14 23:10:45 UTC
Created attachment 174827 [details]
Battery icon showing even at full charge
Comment 6 elydgolden 2024-10-14 23:14:27 UTC
Some more info: I just realized that KDE isn't recognizing my power profiles in this state, which is odd given that I do have power-profiles-daemon installed...
Comment 7 elydgolden 2024-10-15 01:01:44 UTC
Even more info: I can reproduce the bug by forcing a shutdown when plugged in at full charge. Power profiles don't seem to work until I do a proper shut down and then boot back up on battery power
Comment 8 Nate Graham 2024-10-16 18:28:42 UTC
Ok, so when the power profiles subsystem is not available, that's when it happens? Daniel, can you reproduce that too?
Comment 9 Daniel Hofstetter 2024-10-17 11:45:33 UTC
Yes, after installing power-profiles-daemon it works on my machine. Thanks to @elydgolden!
Comment 10 elydgolden 2024-10-17 11:47:37 UTC
No problem! I guess then the fact that power-profiles-daemon isn't getting activated on my machine is a separate issue?
Comment 11 Daniel Hofstetter 2024-10-19 12:49:43 UTC
Yes, it looks like it's a separate issue.
Comment 12 Nate Graham 2024-10-22 18:33:40 UTC
Yes, but the icon hiding when expected definitely shouldn't be dependent on power-profiles-daemon being activated. I'll take a look.
Comment 13 Nate Graham 2024-10-22 18:39:46 UTC
Ahh I see the problem:

    Plasmoid.status: {
        if (inhibitionControl.isManuallyInhibited || !powerProfilesControl.isInDefaultPowerProfile) {
            return PlasmaCore.Types.ActiveStatus;
        }

We're not checking for whether power profiles are actually installed and available. When they're not, all the properties for them are false, and inverting the false becomes true, and boom, the applet becomes active.
Comment 14 Nate Graham 2024-10-22 19:04:25 UTC
Natalie, could you take a look here?
Comment 15 Jakob Petsovits 2025-01-01 00:12:23 UTC
Git commit 6430f5f9b1554e432573ae901d163f6bd7997be7 by Jakob Petsovits, on behalf of Marko Zajc.
Committed on 01/01/2025 at 00:12.
Pushed by jpetso into branch 'master'.

applets/batterymonitor: Assume default power profile is used if power profile is unset

Before this patch, `isInDefaultPowerProfile` was set to `false` when
power-profiles-daemon is not installed. This causes the batterymonitor
system tray entry to remain stuck in the active state, which is
rather annoying.

This happened because `defaultPowerProfile`, which is always set to a
non-empty string, and `activeProfile`, which is blank when the p-p-d
is missing, are not equal.

This patch sets `isInDefaultPowerProfile` to `true` when `activeProfile`
is unset. On a system without p-p-d installed, this fixes the behaviour
of the batterymonitor widget and correctly puts it into passive state.
On a system with p-p-d installed, this does not alter behaviour,
because it only triggers when `activeProfile` is blank.

M  +1    -1    applets/batterymonitor/package/contents/ui/main.qml

https://invent.kde.org/plasma/powerdevil/-/commit/6430f5f9b1554e432573ae901d163f6bd7997be7