Skip to content

Getting Started

Federico edited this page Oct 27, 2018 · 34 revisions

Clight is a C user daemon utility that aims to fully manage your display.
It will automagically change screen backlight level for all monitors, even external ones, to match ambient brightness, as computed by capturing frames from webcam or from an ALS device.
Moreover, it can manage your screen temperature, just like redshift does.
Finally, it can dim your screen after a timeout.

Main Features

  • very lightweight
  • fully valgrind and cppcheck clean
  • external signals catching (sigint/sigterm)
  • systemd user unit shipped
  • a quick single capture mode (ie: do captures, change screen brightness and leave) is provided through a desktop file.
  • GAMMA support: it will compute sunset and sunrise and will automatically change screen temperature (just like redshift does) -> X only
  • DIMMER support: it will dim your screen after specified timeout of user inactivity (ie: no mouse/keyboard) -> X only
  • DPMS support: it will set desired dpms timeouts for AC/batt states. -> X only
  • Both DPMS and DIMMER can be disabled while on AC, just setting dimmer timeout/any dpms timeout for given AC state <= 0.
  • geoclue2 support: when launched without [--lat|--lon] parameters, if geoclue2 is available, it will use it to get user location updates. Otherwise gamma support will be disabled. Location received will be then cached when clight exit. This way, if no internet connection is present (thus geoclue2 cannot give us any location) at restart, clight will load latest available location from cache file. If no cached location is present, gamma will be disabled.
  • --sunrise/--sunset times user-specified support: gamma nightly temp will be setted at sunset time, daily temp at sunrise time.
  • nice log file, placed in $HOME/.clight.log
  • more frequent captures inside "events": an event starts by default 30mins before sunrise/sunset and ends 30mins after. Configurable.
  • conf file placed in both /etc/default and $XDG_CONFIG_HOME (fallbacks to $HOME/.config/) support
  • Lots of configurations available
  • only 1 clight instance can be running for each user.
  • sweet inter-modules dependencies management system with "modules"(BRIGHTNESS, GAMMA, LOCATION, etc etc) lazy loading: every module will only be started at the right time, eg: GAMMA module will only be started after a location has been retrieved. Moreover, modules gets gracefully auto-disabled where unsupported (eg: GAMMA on non-X environments)
  • UPower support, to set longer timeouts between captures while on battery, in order to save some energy.
  • You can specify curve points to be used to match ambient brightness to screen backlight from config file. For more info, see Polynomial fit section below.
  • Clight supports org.freedesktop.PowerManagement.Inhibit interface. Thus, when for example watching a youtube video from chromium, dimmer module won't dim your screen.
  • Supports both internal laptop monitor and external monitors (thus desktop PCs too), thanks to ddcutil.
  • Autodisable brightness module on PCs without webcam
  • Check clightd version on clight startup
  • Smooth gamma/dimmer/backlight transitions
  • Nice dbus interface

Valgrind is run with:

$ alias valgrind='valgrind --tool=memcheck --leak-check=full --track-origins=yes --show-leak-kinds=all -v'

Cppcheck is run with:

$  cppcheck --enable=style --enable=performance --enable=unusedFunction

Will it eat my battery?

No, it won't. Clight aims to be very power friendly. In fact, thanks to blocking I/O, it uses CPU only when needed.
Moreover, being very lightweight on resources helps too. Indeed, it will probably help you saving some battery, by setting correct screen backlight for current ambient brightness (thus avoiding wasting battery on max backlight level).
Finally, remember that webcam is not always on; it is used only when needed with timeouts between clusters of captures thoroughly thought and configurable (with longer timeouts while on battery).

Clone this wiki locally