Highly reactive daemon for adaptive backlight, using camera as light sensor.
- Smooth backlight adaptation
- Light fluctuations filtering
- Auto-calibration
- Delayed start
- One-time mode
- Auto-restart on configuration file change
- Performance: up to 30fps for camera input without notable performance losses
- No need for systemd or X, though xbacklight may be used
- ncurses - for colored output
- util-linux - use hexdump instead of od
- inotify-tools - to auto-restart on configuration change
Note: It will tell when necessary tools are missing.
Run with default settings
$ backlightadapt
Type backlightadapt -h
to see all options.
Toggle running
$ backlightadapt -t
Match backlight once to current light level and quit.
$ backlightadapt -1
Update maximum light level to current
$ backlightadapt --calibrate
Backlight can change smoothly by using chain of multiple filters. There are two supported types of filters. Median filter starts the chain, while average (box) filters go next. First filter excludes short light fluctuations (less than half of buffer size), next filters smooth changes.
Filters description format: SIZE,SIZE...
Filter sizes with size 0 or 1 are skiped. Setting first to such size effectively disables median filter. If it's the only element in list, smoothing is completely disabled.
- Instant, reflex-like reaction:
$ backlightadapt --smooth 0
- Exclude shortest fluctuations:
$ backlightadapt --smooth 10
- Smooth change:
$ backlightadapt --smooth 8,6,6
- Smoothing without fluctuation exclusion:
$ backlightadapt --smooth 0,6,6
- Slow accomodation:
$ backlightadapt --smooth 60,70,70
Two or three equally sized filters seem to be most optimal setup.
Lone average filter makes linear transition for lone jump between two stable levels, but for short fluctuation it will be just small but constant change for duration of filter latency.
2nd average filter turns it to linear fade on and off. This should be enough for usable result - for stable change it makes smooth result. If first filter is median - result as previous case, but no fluctuations, causing stable shifts for filter's latency.
3rd filter makes smooth wave even for shortest fluctuations (if median was disabled), but each extra stage adds notable latency in visible reaction. One median and two average filters, all equally sized, should be ideal combination in most cases.
Configuration file is automatically created if no other file exists and writeable config directory is found. It may be later updated from command line options by appending --update-conf
command line option. If combined with --pretend
option, configuration will be updated without launch.
Update backlight to luminance ratio to current. This may be done either by running with --calibrate
option or by sending SIGUSR2 to working instance (will send a signal if there is runing instance).
- Environmental variable
$XDG_CONFIG_DIR
~/.config
/etc
- SIGUSR1 - reload configuration
- SIGUSR2 - calibrate
Following steps are necessary for internal ACPI backend to work.
- Place 90-backlight.rules into /etc/udev/rules.d or /lib/udev/rules.d to enable write permissions for internal ACPI backend (requires reboot).
- Make sure, that you are in video group (requires relogin).
Note: other tools like acpilight or light may have it already done.
Please report bugs at github or opencode project page.
Shell script only makes setup, all dirty job is done by persistant ffmpeg-based pipeline.
See more backlight utilities