Bug 444029

Summary: Keyboard backlight not always automatically disabled on laptop lid close
Product: [Plasma] Powerdevil Reporter: Mike Lothian <mike>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: major CC: agurenko, janne-kde, kde, marcan, nate, orangewinds
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.27
Sentry Crash Report:

Description Mike Lothian 2021-10-19 10:18:51 UTC
This is a feature request

There's an option to control Keyboard brightness when the laptop is plugged in, or on battery, it would be great if there was an option to control that brightness on lid close too

An extra slider would be great

Out of interest where in the code base are the existing controls? Will try and write a patch if you point me in the right direction
Comment 1 Nate Graham 2021-10-19 21:49:10 UTC
This is for the case where you've configured your laptop to stay awake on lid close, right? Otherwise it wouldn't make much sense as the laptop would go to sleep and the keyboard backlight would automatically go off.

Probably we should automatically disable the keyboard backlight when closing the lid but not going to sleep, as there's never a use case for illuminating something that can't be seen! Then when opening the lid again, if the backlight was turned off automatically, turn it back on.

Thanks for offering to produce a patch! the code lives in the powerdevil repo: https://invent.kde.org/plasma/powerdevil

Note that this KCM is currently being rewritten. However if no UI is added for this, then hopefully that shouldn't get in the way.
Comment 2 Mike Lothian 2021-10-19 23:33:08 UTC
Hi Nate

Yeah, when my laptop is plugged in I've got it staying awake on lid close, the keyboard stays on and the fancy lights along the bottom stay on too (which are all part of the keyboard lighting) so technically it can be seen - which is annoying at night :P
Comment 3 Hector Martin 2022-12-07 05:36:19 UTC
This is a major power management bug, as leaving the keyboard backlight on while the laptop is closed wastes significant battery power. On An Apple M1 MacBook Air, having the backlight on at full brightness with the lid closed causes a 40% (!) drop in idle battery life (from 28 hours to 17 hours, measured with an idle KDE Plasma session with the lid closed and the latest linux-asahi-edge kernel).

It's "just an LED backlight", but the impact is *massive* on machines with good power management like Apple Silicon Macs.

I recommend increasing the priority, as this really isn't "wishlist" for some machines, it's critical functionality. I'm sure it matters less for machines that chew through batteries even while doing nothing, but not all do :)
Comment 4 Kai Uwe Broulik 2022-12-07 08:31:16 UTC
As always I did not consider dumb hardware. Any laptop I have owned before turned its backlight and keyboard backlight off when the lid was closed, regardless of what the OS was doing...
Comment 5 Janne Grunau 2022-12-07 12:00:19 UTC
With “Dim screen” in the energy savings settings activated the keyboard backlight is turned off at the same time. This happens even when the screen was turned off by closing the lid.
Comment 6 Bug Janitor Service 2022-12-07 20:07:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/122
Comment 7 Nate Graham 2022-12-08 00:57:30 UTC
Hector, can you test the above-mentioned patch and see if it fixes the issue for you?
Comment 8 Mike Lothian 2022-12-08 01:39:56 UTC
It doesn't fix anything for me

I've applied the patch, but I didn't see any differences
Comment 9 Janne Grunau 2022-12-08 07:36:28 UTC
The changes in the merge request work on a Macbook Pro 13" (M2, 2022).
Comment 10 Kai Uwe Broulik 2023-01-13 18:44:11 UTC
Git commit 14f963a8e00204529d402eb80d1f62c44e24741a by Kai Uwe Broulik.
Committed on 13/01/2023 at 17:25.
Pushed by broulik into branch 'master'.

Handle Button Events: Turn off keyboard backlight when lid is closed

There apparently exists hardware that doesn't do that by itself.

M  +21   -0    daemon/actions/bundled/handlebuttonevents.cpp
M  +4    -0    daemon/actions/bundled/handlebuttonevents.h

https://invent.kde.org/plasma/powerdevil/commit/14f963a8e00204529d402eb80d1f62c44e24741a