Skip to content

v4.0

Compare
Choose a tag to compare
@FedeDP FedeDP released this 24 Nov 13:58
· 275 commits to master since this release

Clight 4.0

Hi everyone! Here is a new, shiny Clight release!
This is probably the biggest release ever, with lots of commits and behind the scenes changes.
All in all, it has been a really huge work and it took me really lot of time, but i love what Clight is able to offer right now!
This huge work would not have been possible without having fun spending time on Clight;
yet the fun (and consequently my commitment) would be much lower without lots of enthusiasts users!
Let me thank the more active ones (i am sorry if i forgot anyone...)

Code contributors:

  • ErikPitko (fix keyboard backlight setting) PR #94
  • ILMAZ13 (fix in GAMMA conf loading) PR #63
  • mendelmunkis (fix for some comments in conf file) PR #60
  • yochananmarqos (fix to Arch PKGBUILD) PR #57

Non-code contributors, for their support/ideas/suggestions/time spent on debugging:

  • Alkotronikk
  • demoy
  • mindrunner
  • ModDM

Finally, one more mention; he hasn't got a github account and wrote me lots of mails with his great ideas:

  • Jim Todt

Moreover, a full port to libmodule library, already used in Clightd, took place.
This was needed to strengthen and simplify code, and allows much easier development and powerful features.

By the way, let's see this release's highlights!

New Features

DIMMER

  • Different settings for DIMMER leaving-fading transitions (smooth, timeouts and steps)
  • Thanks to Clightd 4.0, DIMMER module does not require Xorg anymore. It works everywhere (tty too!)

GAMMA

  • GAMMA module does now support long_gamma_transition option, to change gamma in a way similar to redshift/Windows (very long transitioning)
  • (#61) GAMMA now can work ambient-brightness-based, thanks to ambient_gamma option. It means it will change screen temperature based upon current ambient brighness level, following BACKLIGHT module.

BACKLIGHT

  • (#95) Clight now supports up to 50 points for backlight curve
  • (#81) Clight automatic calibration can now be inhibited too by INHIBIT module
  • Clight does now support setting webcam capture parameters, thanks to Clightd 4.0

DPMS

  • Following Clightd 4.0 changes, DPMS is now a special case of screen dimming, and it only supports a single dpms level (ie: screen ON/ screen OFF)
  • Consequently, dpms timeouts for various dpms levels were dropped, leaving a single timeout for each ac_state
  • DPMS does now work on tty too (not on wayland though)
  • When screen enters dpms state, BACKLIGHT module will stop capturing ambient brightness/changing backlight level

SCREEN

  • (#84) Following Clightd 4.0 new API, a new SCREEN module was created. It is needed for a (simple but hopefully effective) screen-emitted-brightness compensation
  • It will compute current screen brightness by taking snapshots of your desktop (they are obviously immediately destroyed!)
  • It then will feed a bucket of configurable size, and after bucket is filled, it will start computing average screen-emitted-brightness
  • Screen-emitted-brightness is then multiplied by a configurable factor and will be subtracted from ambient brightness as found by webcam capture
  • It only works on X
  • It is disabled by default on battery

INTERFACE

  • Expose "KbdPct" property
  • Expose "Temp" property
  • (#50) "NoAutoCalib", "NoKbdCalib", "AmbientGamma" are now writable bus properties
  • Expose "Inhibited" property
  • Expose "ScreenComp" property
  • Expose "ClightdVersion" property
  • Expose "Conf.ScreenContrib" property (writable)
  • Expose "Conf.SensorSettings" property (writable)
  • "Sunrise" an "Sunset" are now writable properties

Config

  • A new cmdline option is now available, that let you specify a custom conf file to be parsed (after global and local ones).
    This can be useful to eg: start Clight with 2 different gamma fixed Sunrise/Sunset times for weekdays and during weekend.
  • Reworked Clight conf file, much better organized now

Generic

  • Added "pause calib" and "resume calib" actions to desktop file
  • Add issue template to github
  • Automatically detect Clightd features and disable corresponding clight modules (ie: if Clightd is built with GAMMA disabled, it will be disabled in Clight too)
  • CPack support was added to CMake, to support both RPM and DEB file generation

CUSTOM MODULES

Using libmodule 5.0.0 allows Clight to runtime load user custom modules.
This means users can write their own plugins in C and attach them to Clight.

  • Added a couple of custom modules examples in wiki pages, with highly requested features
  • Supply a clight public header in /usr/include/clight/public.h to be include to write modules
  • Install a module skeleton in /usr/share/clight/module.skel
  • Clight will try to load custom modules from XDG_DATA_HOME/clight/modules.d/ (fallbacks to .local/share/clight/modules.d where XDG_DATA_HOME is not set), and /usr/share/clight/modules.d/
  • XDG_DATA_HOME modules will have higher priority, ie: you can shadow a global custom module with a local one.
  • There cannot be 2 modules with same name
  • Custom modules can log to clight log too!
  • Through custom modules, user can practically call any Clight feature in a very easy way

A related wiki page has been added: https://github.com/FedeDP/Clight/wiki/Custom-Modules.

INHIBIT rewrite

After a nice and long discussion about org.freedesktop.PowerManagement support, i realized that the correct way to handle
inhibition requests was not org.freedesktop.PowerManagement support.
Indeed it is org.freedesktop.ScreenSaver support.
PowerManagement inhibition is sent eg: by your torrent application while a download is active, or by your FM while a copy is ongoing. Thus it is wrong for Clight to support it.
Instead, Clight should implement org.freedesktop.ScreenSaver API letting other applications transparently inhibit it.
This interface is widely supported; eg: chromium will call Inhibit method while watching a youtube video, ONLY while tab is on foreground. This is great!

There is a downside though: if org.freedesktop.ScreenSaver API is already provided by anyone (eg: your DE, that is the case for me on KDE) you are out of luck, as only one program (ie: the first to request the dbus name) can provide the same dbus interface at the same time.
But there is a workaround, already included: monitor requests sent to org.freedesktop.ScreenSaver bus name on bus, the same way as "busctl --user monitor org.freedesktop.ScreenSaver" is implemented.
This way, Clight can still be notified when anyone requests an (un)inhibition.

So, summing it up:

  • Best case: org.freedesktop.ScreenSaver available -> you'll have everything working fine; DIMMER and DPMS will be inhibited in a much better way than now: eg: chromium will only keep is inhibition ON while you're in a tab that is playing video. If you change tab, ScreenSaver inhibition will be dropped.
    Moreover, ScreenSaver inhibition is only enabled for videos.
  • Worst case: org.freedesktop.ScreenSaver API is already owned by another software, eg: your DE powermanager. Clight will fallback at monitoring org.freedesktop.ScreenSaver requests and will react to them as if these requests were actually sent to it.

Consequently, all PowerManagement part was dropped, and ScreenSaver spec is now gracefully implemented.
"no_inhibit" configuration was dropped as it was kind of useless: inhibition does not harm anything and does not use resources; it is only convenient and has no downsides.
A related wiki page has been added: https://github.com/FedeDP/Clight/wiki/ScreenSaver-Specification.

Fixes

Generic

  • (#70) Fixed build when LIBSYSTEMD_VERSION is a float
  • Fixed small conf reading bug
  • Fixed a bug in reset_timer with < 0 old values
  • a PR sent to Geoclue to fix a 20s hang on startup has been created and merged. Geoclue 2.5.4 and later already ship the fix.
  • Fixed internally used bus::call() function to actually work on libsystemd < 234.

BACKLIGHT

  • (#94) Fixed issue with call() variadic argument for keyboard backlight

GAMMA

  • (#78) Fixed a case of wrong daylight calculation (wrong Sunrise/Sunset times)

LOCATION

  • 0.0:0.0 is actually a good location. Avoid using these values to filter away unsetted location
  • Dropped get_distance method, directly using Geoclue2 threshold. "TimeThreshold" was needed too: "When TimeThreshold is zero, it always emits the signal."
  • Only cache location when leaving if any geoclue2 client was initialized

And surely much more fixes and improvements all over the place i am currently forgetting!

Hope you'll enjoy Clight 4.0!