A crappy attempt to persist keyboard backlight state across power states (reboot, hibernate, suspend etc).
On my recently aquired System76 Darter Pro (darp8) I found that, if not using Pop_OS!, the keyboard backlight state is not persistent through shutdowns.
Fortunately, /sys/class/leds/system76_acpi::kbd_backlight/
provides a simple text-file based means to read and write state.
- A modern version of python3, available in systemd's PATH. Developed with 3.10.6 but will likely work with other versions!
- Place the python script somewhere, with executable permissions. For safety, prohibit modification by regular users.
- Symlink the script under
/usr/lib/systemd/system-sleep/
as per systemd-suspend.service - Copy s76-kbd-led-statemgr.service to
/etc/systemd/system
, runsystemd daemon-reload && systemctl enable --now s76-kbd-led-statemgr.service
- Once set up, systemd will run the program as necessary.. Specifically, it takes one argument, the the word 'pre' or 'post.' Other values or additional arguments are silently discarded.
This project is licensed under the MIT License - see the LICENSE.txt file for details