Bug 448520

Summary: Icon of Battery applet is not monochrome with no battery KDE 5.24 beta
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: Battery MonitorAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, kainz.a, kde, lemmyg, me, nate, nicolas.fella, postix, rapiteanu.catalin
Priority: NOR Keywords: regression
Version: 5.23.90   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.24
Sentry Crash Report:
Attachments: screenshot
screenshot with examples
always show
red battery indicator
the red battery indicator has a single device that has 55% battery charge

Description Patrick Silva 2022-01-15 11:34:54 UTC
Created attachment 145488 [details]
screenshot

STEPS TO REPRODUCE
1. install Plasma 5.24 beta on a computer without a battery
2. 
3. 

OBSERVED RESULT
as we can see in the attached screenshot, the icon of Battery applet in system tray is green, not monochrome

EXPECTED RESULT
monochrome icon

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 1 galder 2022-01-16 10:53:07 UTC
Hello,
I can confirm this issue. From what I see is not related to not having a battery. Is just the monochrome version is missing for thebattery applet. The applet works as expected with not battery, hiding it.  However, when is  set to "always show", it will appear the green icon.


SOFTWARE/OS VERSIONS
Operating System: Kde Neon 5.24 beta image.
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Graphics Platform: X11
Comment 2 galder 2022-01-16 11:14:51 UTC
Created attachment 145531 [details]
screenshot  with examples

apple correctly hidden with no battery but we can see the green version in the notification menu.
Comment 3 galder 2022-01-16 11:16:01 UTC
Created attachment 145532 [details]
always show

green apple visible with always show. We should see the monochrome version
Comment 4 Nicolas Fella 2022-01-16 18:20:59 UTC
Probably caused by https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1305
Comment 5 Nate Graham 2022-01-17 21:32:20 UTC
Yeah it was definitely caused by that.

FWIW I cannot reproduce with current state of 5.24 or git master; I get the monochrome icon when I force the "no batteries" condition by changing the code to make `hasBatteries` be `false`.
Comment 6 galder 2022-01-17 22:10:22 UTC
Hello Nate,
did you try setting the applet to "always shown"?
Comment 7 Nate Graham 2022-01-17 22:31:12 UTC
Based on the code, I'm not sure how that would make a difference, and indeed, when I give it a try, it doesn't.
Comment 8 Patrick Silva 2022-01-17 22:40:02 UTC
On my system the icon is always green. The used visibility mode does no difference.
Comment 9 Nate Graham 2022-01-17 22:41:18 UTC
Folks who can reproduce this, can you list what you are you using for your Plasma theme and Icon theme? And can you reproduce it when both are Breeze?
Comment 10 Viorel-Cătălin Răpițeanu 2022-01-17 22:50:14 UTC
(In reply to Nate Graham from comment #9)
> Folks who can reproduce this, can you list what you are you using for your
> Plasma theme and Icon theme? And can you reproduce it when both are Breeze?

I'm using KDE Neon Unstable in a VM (last updated 3 minutes ago) and it's still reproducing. Nothing was changed on this VM from the default (theme/icons/settings/etc).
Comment 11 Patrick Silva 2022-01-17 23:03:48 UTC
I have applied a 3rd-party global theme, switched back to Breeze global theme and the icon is still green.
Comment 12 Patrick Silva 2022-01-17 23:18:12 UTC
On my laptop running neon unstable the icon is monochrome.
The bug occurs when there is no battery the screen brightness is not adjustable maybe?
Comment 13 galder 2022-01-17 23:28:30 UTC
I updated my VM with latest 5.24 beta packages.
Still I see the no battery green icon. However in my case I need to set it to always shown other ways is hidden.
Maybe is related to the VM.
I hope it helps.
Comment 14 Viorel-Cătălin Răpițeanu 2022-01-18 01:27:45 UTC
> Maybe is related to the VM.
This happens on both the KDE Neon VM and my Arch Linux 5.24 beta install (bare metal).

> On my laptop running neon unstable the icon is monochrome.
> The bug occurs when there is no battery the screen brightness is not adjustable maybe?
Good point. My testing environment is a desktop PC.
Also, the 'Battery and Brightness' panel (aside the Manually block sleep checkbox) displays:
- On my bare metal Arch system, displays only one entry (the battery status of my Wireless mouse).
- On the Neon VM it isn't showing anything. It's just an empty panel.

As a side note, the battery status indicator for my mouse (Wireless MX Mouse 2S) displays the incorrect percentage. I haven't recharged it in the last week but somehow it's reported as being 100% full).
Comment 15 Viorel-Cătălin Răpițeanu 2022-01-18 01:33:01 UTC
The 100% battery issue is not the indicators fault. Looking at the charging status using upower, it has a note saying that the value should be ignored (probably not implemented f or MX Master 2S).

> upower --dump
Device: /org/freedesktop/UPower/devices/mouse_hidpp_battery_1
  native-path:          hidpp_battery_1
  model:                Wireless Mouse MX Master 2S
  power supply:         no
  mouse
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    warning-level:       none
    battery-level:       full
    percentage:          100% (should be ignored)
    icon-name:          'battery-full-charged-symbolic'
Comment 16 Nate Graham 2022-01-18 21:30:35 UTC
(In reply to Patrick Silva from comment #12)
> On my laptop running neon unstable the icon is monochrome.
> The bug occurs when there is no battery the screen brightness is not
> adjustable maybe?
You see a monochrome battery icon, right? Not a monochrome screen brightness icon?
Comment 17 Bug Janitor Service 2022-01-18 22:08:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1375
Comment 18 Fabian Vogt 2022-01-18 22:22:54 UTC
Git commit 1b9826d3cee4fb2e9c64f842d9fc73b6720a5d07 by Fabian Vogt.
Committed on 18/01/2022 at 22:09.
Pushed by ngraham into branch 'master'.

applets/batterymonitor: Use "video-display-brightness" for !hasBatteries

f9e39815d ("applets/batterymonitor: Improve for desktop systems") changed the
plasmoid to use a plain icon instead of the CompactRepresentation if there are
no batteries.
While 471cc3745 ("applets/batterymonitor: fix CompactRepresentation") brought
the use of the CompactRepresentation back, the plain icon is still used.

For the case that there are no batteries and brightness controls available,
it fell back to "battery", which has no symbolic variant. Change that to use
the symbolic "video-display-brightness" as well.

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

https://invent.kde.org/plasma/plasma-workspace/commit/1b9826d3cee4fb2e9c64f842d9fc73b6720a5d07
Comment 19 Nate Graham 2022-01-18 22:23:36 UTC
Git commit 60a5a14e89cdf075dcb9f34e67970af9aca9c40e by Nate Graham, on behalf of Fabian Vogt.
Committed on 18/01/2022 at 22:23.
Pushed by ngraham into branch 'Plasma/5.24'.

applets/batterymonitor: Use "video-display-brightness" for !hasBatteries

f9e39815d ("applets/batterymonitor: Improve for desktop systems") changed the
plasmoid to use a plain icon instead of the CompactRepresentation if there are
no batteries.
While 471cc3745 ("applets/batterymonitor: fix CompactRepresentation") brought
the use of the CompactRepresentation back, the plain icon is still used.

For the case that there are no batteries and brightness controls available,
it fell back to "battery", which has no symbolic variant. Change that to use
the symbolic "video-display-brightness" as well.


(cherry picked from commit 1b9826d3cee4fb2e9c64f842d9fc73b6720a5d07)

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

https://invent.kde.org/plasma/plasma-workspace/commit/60a5a14e89cdf075dcb9f34e67970af9aca9c40e
Comment 20 Viorel-Cătălin Răpițeanu 2022-01-19 20:41:37 UTC
This was indeed fixed, but the question remains if the battery indicator should be the red colored one (low battery). In my example where I have 1 device. (see attachments)
Comment 21 Viorel-Cătălin Răpițeanu 2022-01-19 20:42:57 UTC
Created attachment 145649 [details]
red battery indicator

The red battery icon gives the impression that there is a low battery device that needs to be recharged.
Comment 22 Viorel-Cătălin Răpițeanu 2022-01-19 20:44:24 UTC
Created attachment 145650 [details]
the red battery indicator has a single device that has 55% battery charge

When opening the low battery indicator, you will see that there is a device that has more than enough battery charge.
Comment 23 Nate Graham 2022-01-19 21:37:16 UTC
Interesting case. However that seems like a separate bug. Can you file a different bug report about it?

What seems to be happening is that since you have at least once device with a battery, it triggers the "I have batteries" code, so it shows a battery icon. But that battery icon itself gets its data only built-in batteries, not the batteries of connected Bluetooth devices. As a result the icon shows an incorrect state.
Comment 24 Viorel-Cătălin Răpițeanu 2022-01-19 21:45:50 UTC
(In reply to Nate Graham from comment #23)
> Interesting case. However that seems like a separate bug. Can you file a
> different bug report about it?
> 
> What seems to be happening is that since you have at least once device with
> a battery, it triggers the "I have batteries" code, so it shows a battery
> icon. But that battery icon itself gets its data only built-in batteries,
> not the batteries of connected Bluetooth devices. As a result the icon shows
> an incorrect state.

I created a new ticket to track this: 448797 (https://bugs.kde.org/show_bug.cgi?id=448797)