Night Color Widget (adapt Redshift Control Widget to kwin's Night Color functionality)

John Salatas jsalatas at ictpro.gr
Thu Oct 24 04:24:52 BST 2019


Hey guys!

I was thinking about resurrecting the Redshift Control Widget, as 
apparently there are users (including me) that find it very convenient 
to be able to enable/disable Night Color with just a click.

Anyway.... I have some questions that I hope you might be able to 
answer. Currently Redshift Control Widget interacts with the redshift 
command through cli commands using an executable datasource engine [1]. 
Given the fact that kwin exposes a dbus interface for the Night Color 
functionality [2], I was thinking that the most straightforward approach 
would be to change the cli commands executed by the executable 
datasource engine and instead of interacting with the redshift command, 
I could use something like qdbus [3], or dbus-send [4] to send messages 
to the kwin's DBus interface.

So my first question is whether I'm right with the above approach. Might 
it be better to communicate with the DBus at some other way? How? Can 
you point me to some documentation, or example implementation?

Furthermore, in case that I want to call setNightColorConfig which 
requires a QHash<QString, QVariant> argument [5], how can I encode it 
for either qdbus or dbus-send?

Finally, I'm not sure if it is better to just create a new git repo and 
create a new widget from scratch borrowing/duplicating most of the 
existing code, or if it is better to continue with the existing 
repo/code and rename the widget from Redshift Control Widget to Night 
Color Widget, or whatever! (btw I'm one of the maintainers of Redshift 
Control Widget) :\

Thank you in advance!

John Salatas


References

[1] 
https://phabricator.kde.org/source/plasma-redshift-control/browse/master/package/contents/ui/main.qml$123

[2] 
https://phabricator.kde.org/source/kwin/browse/master/colorcorrection/colorcorrectdbusinterface.h

[3] https://manpages.ubuntu.com/manpages/bionic/en/man1/qdbus.1.html

[4] https://dbus.freedesktop.org/doc/dbus-send.1.html

[5] 
https://phabricator.kde.org/source/kwin/browse/master/colorcorrection/colorcorrectdbusinterface.h$97



More information about the Plasma-devel mailing list