skeledance/plugin/contents/ui/main.qml
vini 39bc5d0794 feat: chuva mode — moon, rain, lightning; clean transitions with balada
Rain mode with canvas rain, stormy sky, sun-to-moon transition and
lightning strobe. Mode switching fixed so only one of moon/globe shows:
file pollers are edge-triggered (stale /tmp files no longer fight),
toggle scripts keep the files mutually exclusive, exits fade fast while
entrances stay slow, drawGlobe solely owns globe opacity, and leaving
chuva restores the album-color theme on fog/horizon.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015HtPHsTnDcLVSCiF5FGHZj
2026-07-19 10:18:34 -03:00

73 lines
2.3 KiB
QML

import QtQuick 2.0
import QtWebEngine 1.10
import org.kde.plasma.core
import org.kde.plasma.plasmoid
import org.kde.plasma.plasma5support as Plasma5Support
WallpaperItem {
id: root
function applyConfig() {
webView.runJavaScript("setShowSkeleton(" + Plasmoid.configuration.ShowSkeleton + ")")
webView.runJavaScript("setBaladaMode(" + Plasmoid.configuration.BaladaMode + ")")
webView.runJavaScript("setChuvaMode(" + Plasmoid.configuration.ChuvaMode + ")")
}
Connections {
target: Plasmoid.configuration
function onShowSkeletonChanged() { applyConfig() }
function onBaladaModeChanged() { applyConfig() }
function onChuvaModeChanged() { applyConfig() }
}
WebEngineView {
id: webView
anchors.fill: parent
url: Qt.resolvedUrl("dancer.html")
backgroundColor: "#000814"
settings {
javascriptEnabled: true
localContentCanAccessFileUrls: true
localContentCanAccessRemoteUrls: true
localStorageEnabled: false
}
onContextMenuRequested: function(request) {
request.accepted = true
}
onLoadingChanged: function(loadRequest) {
if (loadRequest.status === WebEngineLoadRequest.LoadSucceededStatus)
applyConfig()
}
}
// Start CAVA on load
Plasma5Support.DataSource {
id: cavaStarter
engine: "executable"
connectedSources: ["bash " + Qt.resolvedUrl("cava-start.sh").toString().replace("file://", "") + " &"]
interval: 0
}
// Polls playerctl every 2s and injects music info into the page
Plasma5Support.DataSource {
id: musicSource
engine: "executable"
connectedSources: ["bash " + Qt.resolvedUrl("get-playing.sh").toString().replace("file://", "")]
interval: 2000
onNewData: function(sourceName, data) {
var raw = data["stdout"].trim()
var parts = raw.split("||")
var status = parts[0] || ""
var artist = status === "Playing" ? (parts[1] || "") : ""
var title = status === "Playing" ? (parts[2] || "") : ""
webView.runJavaScript(
"updateMusic(" + JSON.stringify(artist) + "," + JSON.stringify(title) + ")"
)
}
}
}