Linux command
backlit-kbd 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show current backlight
backlit-kbd info
Set brightness
backlit-kbd percent [75]
Set brightness
backlit-kbd set [value]
Increase or decrease
backlit-kbd inc [step]
Example
backlit-kbd dec [step]
Turn backlight on
backlit-kbd on --percent [40]
Turn backlight off
backlit-kbd off
Blink the keyboard
backlit-kbd blink --count [4] --on-ms [100] --off-ms [100]
Test without hardware
backlit-kbd --mock percent [50]
说明
backlit-kbd is a Python command-line utility for controlling the keyboard backlight on Linux. It auto-discovers compatible LED devices exposed by the kernel under /sys/class/leds/, typically vendor-specific paths such as tpacpi::kbd_backlight (Lenovo ThinkPad), asus::kbd_backlight (ASUS), or dell::kbd_backlight (Dell). The tool exposes high-level commands (_set_, _percent_, _inc_, _dec_, _on_, _off_) for everyday brightness control and a pair of _blink_ / _notify_ commands for producing visual notifications via the keyboard LEDs. A --mock flag swaps the backend for an in-memory simulator, making it safe to experiment or integrate into scripts on machines without a real backlight device.
参数
- info
- Display current backlight state and detected device information.
- set _value_
- Set the brightness to a raw level value supported by the device.
- percent _value_
- Set the brightness as a percentage between 0 and 100.
- inc _step_
- Increase brightness by _step_ (default: 1).
- dec _step_
- Decrease brightness by _step_ (default: 1).
- on --percent _N_
- Turn the backlight on, optionally at a given percentage.
- off
- Turn the backlight off.
- blink _options_
- Run a synchronous blink pattern on the keyboard.
- notify _options_
- Run an asynchronous notification blink without blocking the shell.
- --mock
- Use an in-memory backend for safe testing without writing to hardware.
- --device-path _PATH_
- Target a specific sysfs device path instead of auto-discovery.
- --count _N_
- Number of blink cycles (used with _blink_ / _notify_).
- --on-ms _N_
- Duration in milliseconds for the on state during blink.
- --off-ms _N_
- Duration in milliseconds for the off state during blink.
- --level-percent _N_
- Brightness level during blink cycles.
- --name _NAME_
- Notification identifier (used with _notify_).
FAQ
What is the backlit-kbd command used for?
backlit-kbd is a Python command-line utility for controlling the keyboard backlight on Linux. It auto-discovers compatible LED devices exposed by the kernel under /sys/class/leds/, typically vendor-specific paths such as tpacpi::kbd_backlight (Lenovo ThinkPad), asus::kbd_backlight (ASUS), or dell::kbd_backlight (Dell). The tool exposes high-level commands (_set_, _percent_, _inc_, _dec_, _on_, _off_) for everyday brightness control and a pair of _blink_ / _notify_ commands for producing visual notifications via the keyboard LEDs. A --mock flag swaps the backend for an in-memory simulator, making it safe to experiment or integrate into scripts on machines without a real backlight device.
How do I run a basic backlit-kbd example?
Run `backlit-kbd info` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does info do in backlit-kbd?
Display current backlight state and detected device information.