I recently looked into the nightcolor widget hoping to add a mousewheel control to temporarily force a specific color like the Redshift Control widget does. Unfortunately I realized the existing API in the NightColor QML plugin doesn’t have the function to do so. So I dived into the NightColor DBus API using qdbusviewer, as I was hoping to run a qdbus command. The Night Color effect is done by KWin, and is codenamed “ColorCorrect” in it’s code.
It looks like the setNightColorConfig(QVariantMap) function will work. It accepts a dictionary of config keys and values.
Unfortunately neither qdbus or dbus-send support passing a VariantMap (a{sv}) as an argument. So I realized I needed to write a python script that uses the dbus module to call:
The dbus module is fairly straighforward. First get the session’s bus. Then use the NightColor servicename and path to get the object. Next get the interface of the function we want to call. Here’s a simple example that prints the current nightColorInfo config properties. It’ll list everything we can set.