Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brightness fixes #403

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ByteMaster1337
Copy link

Fix a simple bug in KBD backlight toggle key handling and add some functionality to make KBD and LCD backlight control behave a bit more sane.
Fixes #187 as LCD brightness changes by function keys in battery mode are saved to config now.
It does not fix the problems with keyboard backlight described there, as I found this is a completely different issue. For example on my lenovo laptop, changing keyboard backlight by Fn+Space does not generate a scancode, thus GPM can't keep track of changes made to keyboard backlight. One might come up with some trickery to take such untracked changes in hardware into account, but I found a quick fix that adds a switch to completely disable KBD brightness control in dconf more useful for now.

Always set brightness. If running on battery and battery dimming is
disabled, the AC value should be used instead of doing nothing.
This partly reverts commit 3fb36a3dce47e86d3cf8f855ba56765aa4372ac6a -
I may stand corrected, but I don't see the intention of the
"GPM_SETTINGS_KBD_BACKLIGHT_BATT_REDUCE" switch is to completely disable
control of keyboard backlight. It seems even more random only doing this
when running on battery.
Completely disabling kb backlight control should be offloaded to a
separate switch like in LCD backlight control (see GPM_SETTINGS_BACKLIGHT_ENABLE).
Toggling backlight brightness would always write 0 before.
Now saved_brightness is initilized to 0 and only gets changed when
brightness toggle is switched off.
Also save brightness config changes when running on battery.
To do that, calculate backlight dim factor and ac brightness factor from
master percentage value so that ac factor is only changed if brightness
is further increased when battery dim factor is already zero.
This behaviour seems less random to me than only saving changes when
running on AC.
Add power manager switch to completely disable keyboard backlight
brightness control by GPM. This goes together with reverting the patch
that allows to disable keyboard backlight control via
kbd-backlight-battery-reduce.
@lukefromdc lukefromdc requested a review from a team October 12, 2024 18:38
@lukefromdc
Copy link
Member

I cannot test this myself, as I don't have anything with a backlit keyboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

brightness does not return to value set by the function keys on battery
2 participants