- Notifications
You must be signed in to change notification settings - Fork6
Auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux
License
saibotd/tp-auto-kbbl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
tp-auto-kbbl
enables keyboard backlighting whenever you start typing. After typing ends (+ timeout), the backlight turns off automatically. It runs in the background on your Linux laptop and checks for keyboard events (default/dev/input/event3
).
It should work on any ThinkPad (tested on a 470s) and probably other laptops as well.Let me know if it runs on your device.
To keep CPU/RAM usage low and portability high, I've usedRust for development.This is my first project with it, so if spot anything weird – or plain wrong – let me know! I'm thankful for any advice.
tp-auto-kbbl
works similar to a keylogger (requires root to capture keyboard events system-wide). Always be sure to check the source code.
Usage: tp-auto-kbbl [options]Options: -h, --help prints this help message -v, --version prints the version -n, --no-dim don't dim before bg turns off -l, --lazy don't check actual hw brightness state -d, --device specify the device file -b, --brightness target keyboard brightness (1-2) -t, --timeout time before the bg light turns off
Download the latestrelease, or clone and build it yourself.
sudo cp tp-auto-kbbl /usr/bin/
tp-auto-kbbl# You'll probably get an error like thisthread 'main' panicked at 'Permission denied (os error 13)', src/main.rs:44:74# Once more as rootsudo tp-auto-kbblInput device ID: bus 0x11 vendor 0x1 product 0x1Evdev version: 10001Input device name: "AT Translated Set 2 keyboard"Phys location: isa0060/serio0/input0Setting brightness to 0
Your backlight should turn off immediately. Try if it turns on when you press any button.If not, check if the input device is correct, you may adjust it via the-d
parameter.
# Copy the [unit file](https://raw.githubusercontent.com/saibotd/tp-auto-kbbl/master/tp-auto-kbbl.service)sudo cp tp-auto-kbbl.service /etc/systemd/system/# (optional) Check if the parameters are correctsudo nano /etc/systemd/system/tp-auto-kbbl.service# Reload daemonssudo systemctl daemon-reload# Start the servicesudo systemctl start tp-auto-kbbl# Check if the service runs finesudo systemctl status tp-auto-kbblMär 04 14:02:06 Huffer systemd[1]: Started Auto toggle keyboard back-lighting.Mär 04 14:02:06 Huffer tp-auto-kbbl[343]: Input device ID: bus 0x11 vendor 0x1 pMär 04 14:02:06 Huffer tp-auto-kbbl[343]: Evdev version: 10001Mär 04 14:02:06 Huffer tp-auto-kbbl[343]: Input device name: "AT Translated SetMär 04 14:02:06 Huffer tp-auto-kbbl[343]: Phys location: isa0060/serio0/input0Mär 04 14:02:07 Huffer tp-auto-kbbl[343]: Setting brightness to 0Mär 04 14:02:09 Huffer tp-auto-kbbl[343]: Setting brightness to 2Mär 04 14:02:25 Huffer tp-auto-kbbl[343]: Setting brightness to 0# Finally enable the servicesudo systemctl enable tp-auto-kbbl
Copyright © 2020 Tobias Duehr
About
Auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux