Skip to content
Federico Di Pierro edited this page Feb 28, 2021 · 40 revisions

Clight may work well on its own, but where it shines is its DBus interface! You can control many aspects of how the program works through integration with other programs or your own scripts!

With that being said, there may be a few common questions.

Table of contents

  1. Common issues
  2. Dbus tricks

Common Issues

Where is Clight log?

Clight log is located in $XDG_DATA_HOME/clight/clight.log; normally it should resolve to .local/share/clight/clight.log.

Where is Clight conf?

Clight conf file is located in /etc/default/clight.conf.
For more info: https://github.com/FedeDP/Clight/wiki/Config.

How to enable verbose mode?

Open Clight conf file and uncomment verbose = true; line.

Clight keeps running even after my session was killed

Some distro ship a systemd-logind conf with flag KillUserProcesses=no.
This means clight will not get killed upon user leaving the session, and will not properly get killed on system shutdown.
I encourage to set the flag to yes.
For more info, read here: https://fedoraproject.org/wiki/Changes/KillUserProcesses_by_default.
You can check your system current KillUserProcesses value through dbus:
busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager KillUserProcesses

I heard Clight works on wayland too; it is doing nothing here though!

Unfortunately on Wayland there is yet no standard protocol for gamma, dpms and screenshots handling.
Most probably your DE does not implement specific protocols.
For more info: https://github.com/FedeDP/Clight/wiki/Modules#wayland-support.

Geoclue asks for permission

Please try to append following lines to /etc/geoclue/geoclue.conf:

[clightc]
allowed=true
system=false
users=

If issues persist, please fill a bug report.

Clight takes up to 20s to start

Recent geoclue2 (2.5.1) has some weird issue and it takes an insane amount of time to start.
It will delay Clight autostart of circa 20s.
A PR was sent to geoclue2 to fix this issue, and it was shipped as part of geoclue2 version 2.5.4.
Sadly, a new Geoclue issue is once more slowing down Clight startup of 20s as of version 2.5.7, see here: https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/141.

DBus tricks

How do I pause the dimmer temporarily?

Clight implements the Freedesktop ScreenSaver interface, meaning many programs will automatically cause Clight to pause itself. If you want finer control, you can use Clight's dbus interface:

busctl busctl --user call org.clight.clight /org/clight/clight org.clight.clight Inhibit b true

and likewise, you can use false to return the dimmer to normal. You can write a script to toggle inhibition:

#!/usr/bin/env python3
import dbus

bus = dbus.SessionBus()
prop = bus.get_object('org.clight.clight','/org/clight/clight')
currVal = prop.Get('org.clight.clight','Inhibited',dbus_interface='org.freedesktop.DBus.Properties')
prop.Inhibit(not currVal,dbus_interface='org.clight.clight')

Finally, Clight desktop file has a quick action to pause/resume dimmer.

How do I change the backlight manually?

Clight should automatically control your brightness to acceptable values, but if you want to override it manually, there are two ways:

  1. Use IncBl and DecBl to increase/decrease.

These two dbus methods can be used to increase and decrease the backlight by a certain percentage.

busctl --user call org.clight.clight /org/clight/clight org.clight.clight IncBl d 0.1

will increase the backlight by 10%. Likewise, you can use DecBl to decrease by 10%.

Here is another script to change the backlight:

#!/usr/bin/env python3

import dbus
import sys

bus = dbus.SessionBus()
obj = bus.get_object('org.clight.clight','/org/clight/clight')

if sys.argv[1] == '-inc':
	obj.IncBl(float(sys.argv[2]),dbus_interface='org.clight.clight')
if sys.argv[1] == '-dec':
	obj.DecBl(float(sys.argv[2]),dbus_interface='org.clight.clight')

which can be used like backlight -inc 0.1 or backlight -dec 0.1.

  1. Set the backlight directly.

The DBus property BlPct can be used to set the backlight to a specific value.

busctl call org.clightd.clightd /org/clightd/clightd/Backlight org.clightd.clightd.Backlight SetAll d\(bdu\)s 0.5 false 0 0 ""

where 0.5 can be changed to the desired value.

If I change the backlight manually, Clight returns it to how it was!

Clight automatically changes the backlight on a timer. You can use the following DBus call to prevent this:

busctl --user set-property org.clight.clight /org/clight/clight/Conf/Backlight org.clight.clight.Conf.Backlight NoAutoCalib b true

and false to return to normal. This can again be put in a script to toggle whenever you need to:

#!/usr/bin/env python3
import dbus

bus = dbus.SessionBus()
prop = bus.get_object('org.clight.clight','/org/clight/clight/Conf/Backlight')
currVal = prop.Get('org.clight.clight.Conf.Backlight','NoAutoCalib',dbus_interface='org.freedesktop.DBus.Properties')
prop.Set('org.clight.clight.Conf.Backlight','NoAutoCalib',not currVal,dbus_interface='org.freedesktop.DBus.Properties')

Finally, Clight desktop file has a quick action to pause/resume backlight autocalibration.

Clone this wiki locally