From 71845ff2a7d5af7c3821d436caaf6df6e7a1787d Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Wed, 10 Jun 2026 15:00:44 -0300 Subject: [PATCH] refactor: replace keybind toggle with config checkbox for skeleton visibility Removes the pynput/curl-based shortcut approach in favour of a plain Plasma wallpaper config checkbox (ShowSkeleton). QML reads the setting on page load and on change, calling setShowSkeleton() in JS directly. Co-Authored-By: Claude Sonnet 4.6 --- plugin/contents/config/main.xml | 12 ++++++++++++ plugin/contents/ui/config.qml | 22 ++++++++++++++++++++++ plugin/contents/ui/dancer.html | 15 +++++++++++---- plugin/contents/ui/main.qml | 13 +++++++++++++ 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 plugin/contents/config/main.xml create mode 100644 plugin/contents/ui/config.qml diff --git a/plugin/contents/config/main.xml b/plugin/contents/config/main.xml new file mode 100644 index 0000000..9c9c205 --- /dev/null +++ b/plugin/contents/config/main.xml @@ -0,0 +1,12 @@ + + + + + + true + + + diff --git a/plugin/contents/ui/config.qml b/plugin/contents/ui/config.qml new file mode 100644 index 0000000..371848d --- /dev/null +++ b/plugin/contents/ui/config.qml @@ -0,0 +1,22 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import org.kde.kirigami 2.20 as Kirigami + +ColumnLayout { + id: root + + property alias cfg_ShowSkeleton: skeletonCheck.checked + + spacing: Kirigami.Units.largeSpacing + + Kirigami.FormLayout { + Layout.fillWidth: true + + CheckBox { + id: skeletonCheck + Kirigami.FormData.label: i18n("Esqueleto:") + text: i18n("Mostrar o robô dançando") + } + } +} diff --git a/plugin/contents/ui/dancer.html b/plugin/contents/ui/dancer.html index 27f5264..ce4bafa 100644 --- a/plugin/contents/ui/dancer.html +++ b/plugin/contents/ui/dancer.html @@ -1172,12 +1172,19 @@ function applyTheme(rgb) { }); } -const albumArtEl = document.getElementById('albumArt'); -const fogWisps = document.querySelectorAll('.fog-wisp'); +const albumArtEl = document.getElementById('albumArt'); +const fogWisps = document.querySelectorAll('.fog-wisp'); const lyricDisplay = document.getElementById('lyricDisplay'); const lyricInner = document.getElementById('lyricInner'); +const robotWrap = document.querySelector('.robot-wrap'); -let lastArtUrl = ''; +let lastArtUrl = ''; +let showSkeleton = true; + +function setShowSkeleton(val) { + showSkeleton = val; + robotWrap.style.opacity = (isPlaying && showSkeleton) ? '1' : '0'; +} /* ── verse display ── */ const ACTIVE_SHADOW = @@ -1340,7 +1347,7 @@ function updateMusic(artist, title) { const sepEl = document.getElementById('musicSep'); const playing = !!(artist || title); isPlaying = playing; - document.querySelector('.robot-wrap').style.opacity = playing ? '1' : '0'; + robotWrap.style.opacity = (playing && showSkeleton) ? '1' : '0'; document.querySelector('.music-ticker').style.opacity = playing ? '1' : '0'; albumArtEl.style.opacity = playing ? '1' : '0'; if (!playing) { diff --git a/plugin/contents/ui/main.qml b/plugin/contents/ui/main.qml index 7402871..aae1e42 100644 --- a/plugin/contents/ui/main.qml +++ b/plugin/contents/ui/main.qml @@ -7,6 +7,15 @@ import org.kde.plasma.plasma5support as Plasma5Support WallpaperItem { id: root + function applyConfig() { + webView.runJavaScript("setShowSkeleton(" + Plasmoid.configuration.ShowSkeleton + ")") + } + + Connections { + target: Plasmoid.configuration + function onShowSkeletonChanged() { applyConfig() } + } + WebEngineView { id: webView anchors.fill: parent @@ -24,6 +33,10 @@ WallpaperItem { request.accepted = true } + onLoadingChanged: function(loadRequest) { + if (loadRequest.status === WebEngineLoadRequest.LoadSucceededStatus) + applyConfig() + } } // Start CAVA on load