Skip to content

daemon: Refactor brightness controllers to prep for minBrightness() addition

I set out to implement the PowerDevil changes suggested in plasma-workspace!4117 (comment 923164), but decided that I couldn't be bothered to add another poorly named function in the same existing naming scheme. So I did some internal renaming first, and also refactored the BrightnessLogic class so it can handle valueMin changes at runtime. This sets the stage for a follow-up MR to actually introduce the variable brightness minimum for real.

Commit messages below for your convenience.


daemon: Simplify ScreenBrightnessController method names

A simple "brightness" instead of "screenBrightness" will do fine, now that this functionality is owned by a dedicated class and doesn't have to compete with keyboard brightness in the same namespace.


daemon: Simplify KeyboardBrightnessController method names

A simple "brightness" instead of "keyboardBrightness" will do fine, now that this functionality is owned by a dedicated class and doesn't have to compete with screen brightness in the same namespace.


daemon: Calculate brightness logic with runtime minimum value

Instead of a hardcoded valueMin() for all displays via overloading, valueMin becomes part of the BrightnessInfo struct and is set by the controller classes directly.

This will allow us to pass a configured minimum value later. For now, we're just moving the hardcoded value to the screen and keyboard brightness controllers respectively.

Furthermore, the BrightnessLogic class now stores its state as a single BrightnessInfo member variable, instead of mirroring each of BrightnessInfo's members as a separate variable.


CC @nclarius, hopefully this is not conflicting with any work you might have started already

Merge request reports

Loading