Skip to content
 
 

Repository files navigation

sonic-night-light

The sonic-night-light provides helpers for scheduling the dark-light cycle. It can be used to implement features such as adjusting the screen color temperature based on time of day, etc.

Features

The sonic-night-light offers a system service that provides the schedule and a client library to subscribe to the updates from the daemon.

Example usage:

#include <KDarkLightScheduleProvider>
#include <KSharedConfig>

auto stateConfig = KSharedConfig::openStateConfig();
auto provider = new KDarkLightScheduleProvider(stateConfig->group(QStringLiteral("DarkLightCycle")).readEntry(QStringLiteral("State")));
connect(provider, &KDarkLightScheduleProvider::scheduleChanged, [provider, stateConfig]() {
    stateConfig->group(QStringLiteral("DarkLightCycle")).writeEntry(QStringLiteral("State"), provider->state());
    stateConfig->sync();

    qDebug() << "next transition:" << provider->schedule().nextTransition(QDateTime::currentDateTime());
});

qDebug() << "next transition:" << provider->schedule().nextTransition(QDateTime::currentDateTime());

License

This project is licenced under LGPL v2.1+, you can find all the information under LICENSES/.

About

fork of https://invent.kde.org/plasma/knighttime

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages