Clight,brightness & redshift adjusting to ambient light with webcam as light sensor

  1. Some thoughts about brightness & redshift adjusting.

0.1 redshift

For a long time I used “redshift” to reduce eye constraint. This app shifts applies a red filter to your screen from sunset to sunrise. This red filter is more and more red till a maximum.
In case you use a photo manager or a video player you don’t want this red filter which modifies the colors. You can disable it with a command line “pkill -USR1 redshift” and enable it with the same command.

You can create a script as


#!/bin/bash
#
pkill -USR1 redshift
/usr/bin/vlc
pkill -USR1 redshift

0.2 Plasma night color

plasma night color does the same work as redshift but there is no mean to disable/enable it with a command line.

I asked to the devs to add command line but they answer “no”.

Then we can’t disable it automatically in a script.

  1. Clight
    1.1. Clight features

https://github.com/FedeDP/Clight

https://github.com/FedeDP/Clight/wiki

https://github.com/FedeDP/Clight/wiki/FAQ

Clight is now a mature app and well debugged.

Clight adjusts brightness (dimmer feature) of the screen and the keyboard lighting to the ambient light using your webcam

Clight adds a red filter to your screen (gamma feature)

  • more and more red to a maximum from sunset to sunrise
    or
  • adjust the red filter to the ambient light using your webcam

After a delay with no action at the keyboard or mouse Clight switches off the screen (warning: plasma also switches off the screen after a delay, I advise to disable it)

1.2. Command line

You can disable Clight brightness adjusting with command line:


busctl --expect-reply=false --user call org.clight.clight /org/clight/clight org.clight.clight Pause "b" true

You can enable Clight brightness adjusting with command line:


busctl --expect-reply=false --user call org.clight.clight /org/clight/clight org.clight.clight Pause "b" false

You can disable Clight red shifting with command line:


busctl --user set-property org.clight.clight /org/clight/clight/Conf/Gamma org.clight.clight.Conf.Gamma NightTemp "i" 6500

You can enable Clight red shifting with command line:


busctl --user set-property org.clight.clight /org/clight/clight/Conf/Gamma org.clight.clight.Conf.Gamma NightTemp "i" 3500

an example of script


#!/bin/bash
#
#Pause brightness adjusting
busctl --expect-reply=false --user call org.clight.clight /org/clight/clight org.clight.clight Pause "b" true

#Set gamma to max gamma
busctl --user set-property org.clight.clight /org/clight/clight/Conf/Gamma org.clight.clight.Conf.Gamma NightTemp "i" 6500

/usr/bin/vlc

#Restore gamma to min gamma 
busctl --user set-property org.clight.clight /org/clight/clight/Conf/Gamma org.clight.clight.Conf.Gamma NightTemp "i" 3500

#Resume brightness adjusting
busctl --expect-reply=false --user call org.clight.clight /org/clight/clight org.clight.clight Pause "b" false



1.3. Installation

Don’t forget to disable plasma night color.

Go to “Clight” page at: https://software.opensuse.org/package/Clight

Select your distro version

Click on “display experimental package”

On the line “hardware” click on “one click” then follow the instructions.

This procedure installs bot Clight and Clightd; moreover, it adds a new “hardware” repo.

After the installation execute



sudo systemctl enable clightd.service

Restart your PC

1.4 A GUI for Clight: Clight-gui

warning: this app is apart Clight and uses its own conf file and don’t modify the Clight conf file if you don’t ask it.
This may lead to confusion.

https://github.com/nullobsi/clight-gui