Bug 485610 - "Power and Battery" Widget icon does not update when changed via `powerprofilesctl`
Summary: "Power and Battery" Widget icon does not update when changed via `powerprofil...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Battery Monitor (show other bugs)
Version: 6.0.3
Platform: Arch Linux Linux
: NOR minor
Target Milestone: 1.0
Assignee: Natalie Clarius
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-15 20:04 UTC by Kye
Modified: 2024-05-02 13:47 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kye 2024-04-15 20:04:29 UTC
SUMMARY


STEPS TO REPRODUCE
1. Install power-profiles-deamon
2. Change the power profile via `powerprofilectl`
3. See that the status icon does not update.

OBSERVED RESULT
Status icon remains in the previous state.

EXPECTED RESULT
Status icon updates to match the current power profile state

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kernel 6.8.5-arch1-1
(available in About System)
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Comment 1 Bug Janitor Service 2024-04-16 03:46:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/349
Comment 2 Bug Janitor Service 2024-04-16 03:46:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4240
Comment 3 Kye 2024-04-16 13:01:33 UTC
Random additional thought but it'd be nice if along with this there's a pop-up indicating the power profile like with brightness, volume or touch pad changes
Comment 4 Natalie Clarius 2024-04-16 13:34:49 UTC
(In reply to Kye from comment #3)
> Random additional thought but it'd be nice if along with this there's a
> pop-up indicating the power profile like with brightness, volume or touch
> pad changes

The pattern we have adopted here is that we show an OSD when there is no other visual confirmation that tge change took effect, eg when using keyboard shortcuts or scrolling on the applet. When you use powerprofilesctl, you would see that the command completed in the terminal so showing an additional pop-up would seem unnecessarily distracting.
Comment 5 Kye 2024-04-16 13:47:44 UTC
(In reply to Natalie Clarius from comment #4)
> The pattern we have adopted here is that we show an OSD when there is no
> other visual confirmation that tge change took effect, eg when using
> keyboard shortcuts or scrolling on the applet. When you use
> powerprofilesctl, you would see that the command completed in the terminal
> so showing an additional pop-up would seem unnecessarily distracting.
My idea here was if I change it via my laptop keybind.
Comment 6 Natalie Clarius 2024-04-16 14:53:35 UTC
(In reply to Kye from comment #5)
> (In reply to Natalie Clarius from comment #4)
> > The pattern we have adopted here is that we show an OSD when there is no
> > other visual confirmation that tge change took effect, eg when using
> > keyboard shortcuts or scrolling on the applet. When you use
> > powerprofilesctl, you would see that the command completed in the terminal
> > so showing an additional pop-up would seem unnecessarily distracting.
> My idea here was if I change it via my laptop keybind.

So you have a shortcut to switch to a power profile using powerprofilesctl set? Fyi, there is a built-in feature to cycle profiles assigned to Meta+B by default.
Comment 7 Kye 2024-04-16 15:31:52 UTC
(In reply to Natalie Clarius from comment #6)
> So you have a shortcut to switch to a power profile using powerprofilesctl
> set? Fyi, there is a built-in feature to cycle profiles assigned to Meta+B
> by default.

My laptop has a built-in power profile cycle button (TUF a15). 
I'll use the built-in profile switcher, thanks for telling me about that!
Comment 8 Nicolas Fella 2024-05-01 22:36:02 UTC
Git commit 4614e7c4e46cfbc46323c4b5c902e983ca19a237 by Nicolas Fella, on behalf of Natalie Clarius.
Committed on 01/05/2024 at 12:05.
Pushed by nclarius into branch 'master'.

actions/powerprofile: expose configured profile in DBus interface

So the applet can determine whether to show an icon indicating the current profile when it is not the default one.

M  +6    -0    daemon/actions/bundled/org.kde.Solid.PowerManagement.Actions.PowerProfile.xml
M  +6    -0    daemon/actions/bundled/powerprofile.cpp
M  +3    -0    daemon/actions/bundled/powerprofile.h

https://invent.kde.org/plasma/powerdevil/-/commit/4614e7c4e46cfbc46323c4b5c902e983ca19a237
Comment 9 Natalie Clarius 2024-05-01 22:48:08 UTC
Git commit 67b7f3b6fbe640b0c476b5b6a2e1e8f387a8f426 by Natalie Clarius.
Committed on 01/05/2024 at 22:33.
Pushed by nclarius into branch 'master'.

applets/battery: consistently indicate when in non-default power profile

- fix current profile indicator out of sync betweeen multiple applet instances
- indicate when power profile was manually changed from outside the applet, eg powerprofilesctl
- indicate when power profile was manually set to balanced if this is not the default for the current power state
- don't indicate profile holds if the profile is the default for the current power state anyway

where indicate = show the applet as relevant, and use a special icon for the compact representation.

M  +24   -17   applets/batterymonitor/package/contents/ui/CompactRepresentation.qml
M  +10   -11   applets/batterymonitor/package/contents/ui/main.qml
M  +26   -12   applets/batterymonitor/plugin/powerprofilescontrol.cpp
M  +5    -18   applets/batterymonitor/plugin/powerprofilescontrol.h
M  +17   -0    dataengines/powermanagement/powermanagementengine.cpp
M  +1    -0    dataengines/powermanagement/powermanagementengine.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/67b7f3b6fbe640b0c476b5b6a2e1e8f387a8f426