No description
  • C 98.1%
  • Makefile 1.9%
Find a file
Michael Marley a711b49195 Ensure that event_index will never be lower than 0
I noticed a bug once where the backlight shut off early again,
similar to what would happen before the EV_SYN SYN_DROPPED support
was working properly.  This, however, was not the cause of the bug.
However, it is possible that if only one event was returned in a
read, that the loop would read memory below the beginning of the
array.  This would result in effectively no input being processed,
possibly causing the backlight to turn off early.
2026-04-05 20:15:25 -04:00
debian Leverage systemd to open backlight brightness file without root 2024-10-11 19:14:59 -04:00
.gitignore Add support for setting fade duration 2024-08-15 16:55:20 -04:00
gpl-2.0.txt Add the GPL license files 2024-10-21 21:02:35 -04:00
gpl-3.0.txt Add the GPL license files 2024-10-21 21:02:35 -04:00
keylightc.c Ensure that event_index will never be lower than 0 2026-04-05 20:15:25 -04:00
keylightc.service Lock down the systemd unit as much as possible 2025-06-01 12:36:34 -04:00
Makefile Add -Wextra to compiler flags and fix the issues it revealed 2026-04-04 21:19:26 -04:00
README.md Leverage systemd to open backlight brightness file without root 2024-10-11 19:14:59 -04:00

keylightc

Keyboard backlight daemon for Framework laptops in C

keylightc is a small system daemon for Framework laptops that listens to keyboard and touchpad input, and turns on the keyboard backlight while either is being used. It is like keylightd except in C and with no dependencies!

Package Installation

It is highly recommended to install a package if one is available. Currently, a PPA is available for Ubuntu. To set it up, run:

$ sudo add-apt-repository ppa:mamarley/keylightc-git
$ sudo apt update
$ sudo apt install keylightc

Source Installation

To install from source, clone the repository and run:

$ make
$ sudo make install
$ sudo systemctl enable --now keylightc.service

keylightc has no dependencies you have to install first. Really. It works using the sysfs keyboard backlight interface introduced in Linux 6.11 and therefore requires at least that version. It uses kernel event data directly and does not have any dependency on a desktop environment or display server.

Running

Note that keylightc must either be run as root or using the included systemd unit. Using the .deb package or executing the source installation commands above sets this up for you.

keylightc takes the following command-line arguments:

Usage: keylightc [--brightness <brightness>] [--fadeduration <fadeduration>] [--timeout <timeout>]
keylightc - automatic keyboard backlight daemon for Framework laptops
Options:
  --brightness          brightness level when active (1-100) [default=30]
  --fadeduration        fade time in microseconds (1-1000000) [default=100000]
  --timeout             activity timeout in seconds (1-2147483647) [default=10]
  --help                display usage information