Bug 484663 - Switching from low battery mode to AC power should restore previous screen brightness
Summary: Switching from low battery mode to AC power should restore previous screen br...
Status: CONFIRMED
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-28 13:17 UTC by devillelethibault
Modified: 2024-04-17 10:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description devillelethibault 2024-03-28 13:17:18 UTC
SUMMARY
On my work laptop, which has nice specs but *horrible* battery life, I raised the low battery threshold a bit to indicate when I should save my work and power off the machine or plug it into the wall. However, when I do that, my screen brightness stays way down, and I have to manually put it back where it previously was.

STEPS TO REPRODUCE
1. Set the desired low brightness in "Settings > Energy Saving > Low Battery > Change screen brightness".
2. Wait for the low battery mode to kick in.
3. Plug the laptop into the wall.

OBSERVED RESULT
Brightness stays at the "Low Battery" setting.

EXPECTED RESULT
Brightness should be set back to whatever it was when in "normal" battery mode.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-8850H CPU @ 2.60GHz
Memory: 31,0 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630
Manufacturer: Dell Inc.
Product Name: Precision 5530

ADDITIONAL INFORMATION
The behaviour I desire is close to what I remember macOS doing in the early 2010's (unsure if they still do it). It works this way : when the laptop enters a "Low Battery" mode, the maximum brightness level the panel can reach is lowered, but the user *still* has a 0%-100% range on their software brightness slider. Setting a new brightness while in low battery mode amounts to setting the panel to (user_setting * factor) where `factor` is a limit to how bright the screen can be in low battery mode (usually somewhere near 20%). Once the laptop goes out of "Low Battery" mode, the `factor` is set to 1 and the "full" range of the panel's brightness can be achieved.

This should probably be implemented in such a way that a message is displayed below the brightness slider saying something akin to "Low battery: brightness limited" or "Limited by battery settings" while the `factor` is below 1.
Comment 1 Natalie Clarius 2024-03-28 15:44:58 UTC
Powerdevil should already automatically switch to the configured screen brightness for the AC profile if one is set.

Does it not do this? - Then this is a bug.

Or would you like to not configure a default screen brightness for on AC but have it switch back to wherever it was last time before you unplugged?

We could think about this, but imo it is good to have a way of opting out of brightness being automatically changed when plugging/unplugging, and this is what having the "change screen brightness" slider being optional provides.
Comment 2 devillelethibault 2024-03-28 15:51:03 UTC
(In reply to Natalie Clarius from comment #1)
> Or would you like to not configure a default screen brightness for on AC but
> have it switch back to wherever it was last time before you unplugged?

Yes, this is exactly the feature I would like !

I've given my two cents on some specifics for this feature in the additional info section, but it was clear in my mind that this should of course be activated with a user setting. Maybe if the user did not set a predefined brightness level for the plan they're switching to, or using an explicit checkbox ? Either way, this would add one more property to switch in and out of "low battery" mode.
Comment 3 Natalie Clarius 2024-03-28 15:57:06 UTC
The factor logic you described in the details sounds intresting but imo it is too restrictive to enforce a capped maximum brightness whenever on low battery; I might prefer to decide for myself that I'd like to keep running on max brightness as long it still has some juice left and plug in when I have to.

Another checkbox to restore previous brightness instead of a fixed one would be a possibility but further complicated the already lengthy power settings. I'll keep it open as a wishlist item.
Comment 4 Jakob Petsovits 2024-04-03 23:13:59 UTC
(In reply to devillelethibault from comment #2)
> (In reply to Natalie Clarius from comment #1)
> > Or would you like to not configure a default screen brightness for on AC but
> > have it switch back to wherever it was last time before you unplugged?
> 
> Yes, this is exactly the feature I would like !

Thank you. This has been bugging me forever and was perhaps my main motivation for reworking the Power Management settings page in Plasma 6.0. It's still unsolved at this point and I appreciate others speaking up on the same issue.

> The factor logic you described in the details sounds intresting but imo it is too restrictive to enforce a capped maximum brightness whenever on low battery; I might prefer to decide for myself that I'd like to keep running on max brightness as long it still has some juice left and plug in when I have to.

Agreed. Alternative suggestion: PowerDevil in brightnesscontrol.cpp already has logic to prevent a profile transition to "lower power" from increasing brightness. We could easily add the opposite and prevent it from reducing brightness when AC is plugged in again.

> Another checkbox to restore previous brightness instead of a fixed one would be a possibility but further complicated the already lengthy power settings.

How about we view it as an opportunity to reduce the settings that a user gets to see by default? If there is *only* a checkbox to manually set brightness across profiles, and the three sliders are hidden away on a separate sub-page (you know the one: https://invent.kde.org/plasma/powerdevil/-/issues/10#note_775764) then we don't need an extra line and it can be cleaner both in terms of looks as well as less confusing default behavior.

But what I also really like about this setup is that there is *always* a configured brightness value. No more "switching to Battery has a brightness change configured, but switching back to AC is a no-op". The current state can always be reconstructed from configuration. That will be a major win.