1.2 KiB · text History bd286fb
import QtQuick
import org.kde.plasma.plasmoid
import "schedule.js" as Schedule

WallpaperItem {
    id: root

    readonly property var cfg: root.configuration
    property var scheme: Schedule.palette(cfg, new Date())

    function refresh() {
        scheme = Schedule.palette(cfg, new Date())
    }

    // The sun moves slowly enough that once a minute is smooth, and the
    // Field eases between the steps.
    Timer {
        running: root.cfg.ThemeMode === "sun"
        interval: 60000
        repeat: true
        onTriggered: root.refresh()
    }

    Connections {
        target: root.cfg
        function onValueChanged() { root.refresh() }
    }

    Field {
        anchors.fill: parent
        pattern: root.cfg.Pattern
        fadeFrom: root.cfg.FadeFrom
        fadeTo: root.cfg.FadeTo
        bokehLights: root.cfg.BokehLights
        speed: root.cfg.Speed
        frameRate: root.cfg.FrameRate
        wordmark: root.cfg.Wordmark
        base: root.scheme.base
        deep: root.scheme.deep
        ink: root.scheme.ink
        tone: root.scheme.tone

        // Lets Plasma re-derive its accent colour when the palette moves.
        onBaseChanged: root.accentColorChanged()
    }
}