Skip to content
Federico edited this page Nov 16, 2018 · 4 revisions

Clightd brightness API was primarily developed with laptops in mind; it does now support desktop PCs too, through ddcutil.

For laptops, brightness related bus interface methods make all use of libudev to write and read current values (no fopen or other things like that).
All method calls use libudev to take correct device path, and fallback to first subsystem matching device if empty string is passed.
For desktop PCs, ddcutil gets used to change external monitor brightness. For more info, see ddcutil section.

Getgamma function supports 50-steps temperature values. It tries to fit temperature inside a 50 step (eg: it finds 5238, tries if 5200 or 5250 are fine too, and in case returns them. Otherwise, it returns 5238.)

Clightd makes use of polkit: active sessions only can call polkit-protected methods.

You may ask why did i developed this solution. The answer is quite simple: on linux there is no simple and unified way of changing screen brightness.
So, i thought it could be a good idea to develop a bus service that can be used by every other program.

My idea is that anyone can now implement something similar to clight without messing with videodev/libudev and code in general.
A clight replacement, using clightd, can be something like (pseudo-code):

$ ambient_br = busctl call org.clightd.clightd /org/clightd/clightd/Sensor org.clightd.clightd.Sensor Capture "si" "" 1
$ busctl call org.clightd.clightd /org/clightd/clightd/Backlight org.clightd.clightd.Backlight Set "d(bdu)s" $ambient_br 1 0.05 80 ""

Last line will smoothly change current backlight on every internal and external screen it finds.

Clone this wiki locally