Skip to content

Adaptive backlight daemon, using web camera as light sensor

License

Notifications You must be signed in to change notification settings

nick87720z/backlight-adaptive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Adaptive backlight daemon, using camera as light sensor.

License: GPL v3

Features

  • smooth backlight adaptation
  • start with delay
  • one-time mode
  • auto-restart on configuration file change
  • set maximum light to current by SIGUSR2 signal
  • effective: up to 30fps for camera input without notable performance losses
  • no need for systemd or X, though xbacklight may be used

Dependencies

Minimum

Optional (alternative)

Backlight control backends

Note: It will tell when necessary tools are missing.

Usage

Type backlight-adaptive -h to see all options.

Useful options

Run with default settings

$ backlight-adaptive

Toggle running

$ backlight-adaptive -t

Match backlight once to current light level and quit.

$ backlight-adaptive -1

Update maximum light level to current

$ backlight-adaptive --calibrate

Update configuration with command line options included

$ backlight-adaptive --update-conf

Backlight change smoothing

Backlight can change smoothly by using multiple box filter stages. Box filters are effective at any buffer length, and 3 of them are enough to get result, comparable by quality with gaussian or cubic spline. Buffer sizes are specified independently for each filter in form of comma-separated number list (no spaces).

Examples for framerate 30fps

Use short anti-fluctuation filter

$ backlight-adaptive --smooth 6,6

Slow accomodation filter

$ backlight-adaptive --smooth 120,120,20

Note: Two equally sized filters seem to be most optimal setup.

Lone one makes linear transition for lone jump between two stable levels, but for short fluctuation it will be just small but constant change for all duration. 2nd filter turns it to linear fade on and off. This should be enough for usable result - for stable change it makes smooth result. 3rd filter smoothes even shortest fluctuations, but each extra stage adds latency between light change and visible backlight reaction.

Configuration

Configuration file is automatically created if no other file exists and writeable config directory is found. Further update may be forced with --update-conf or -u command line option.

Locations

  • $XDG_CONFIG_DIR
  • ~/.config
  • /etc

Supported signals

  • SIGUSR1 - reload configuration
  • SIGUSR2 - update maximum light level to current

Permissions

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.

Under hood

Shell script only makes configuration, all dirty job is done by persistant ffmpeg-based pipeline.

Known alternatives

See more backlight utilities

About

Adaptive backlight daemon, using web camera as light sensor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages