The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 3,161β€…    Votes:  2β€…
Tags: 16.04   thinkpad   keyboard-backlight  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/1029549
Title: How to prevent the keyboard backlight from turning on when the laptop is woken from sleep?
ID: /2018/04/29/How-to-prevent-the-keyboard-backlight-from-turning-on-when-the-laptop-is-woken-from-sleep_
Created: April 29, 2018    Edited:  September 14, 2020
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


From this reddit post OP had opposite problem with lights always being turned off when resuming from suspend.

You can follow the same approach but change the 1 (on) to a 0 (off).

Find the folder /etc/systemd/system/sleep.target.wants/ and create kb_backlight_resume.service with these contents:

[Unit]
Description=Switch on keyboard backlight after resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
ExecStart=/bin/echo 0 > "/sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness"

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

I don’t have a Thinkpad and my Dell backlight keyboard has different directory structures. I’m unable to test this for your environment. You might have to manually tweak the code if the directory names above are off.

Don’t forget to reboot before testing suspend / resume.


If you have a Dell that doesn’t have /etc/systemd/system/sleep.target.wants/ it can be enabled. For example see:

⇧ Is the GNOME Tweaks package in Software the same as installing gnome-tweak-tool? Enable fractional scaling for Ubuntu 18.04  β‡©