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 <noreply@anthropic.com>
This commit is contained in:
parent
02edf4d9af
commit
71845ff2a7
4 changed files with 58 additions and 4 deletions
12
plugin/contents/config/main.xml
Normal file
12
plugin/contents/config/main.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||||
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
||||||
|
<kcfgfile name=""/>
|
||||||
|
<group name="General">
|
||||||
|
<entry name="ShowSkeleton" type="Bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
</kcfg>
|
||||||
22
plugin/contents/ui/config.qml
Normal file
22
plugin/contents/ui/config.qml
Normal file
|
|
@ -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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1176,8 +1176,15 @@ const albumArtEl = document.getElementById('albumArt');
|
||||||
const fogWisps = document.querySelectorAll('.fog-wisp');
|
const fogWisps = document.querySelectorAll('.fog-wisp');
|
||||||
const lyricDisplay = document.getElementById('lyricDisplay');
|
const lyricDisplay = document.getElementById('lyricDisplay');
|
||||||
const lyricInner = document.getElementById('lyricInner');
|
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 ── */
|
/* ── verse display ── */
|
||||||
const ACTIVE_SHADOW =
|
const ACTIVE_SHADOW =
|
||||||
|
|
@ -1340,7 +1347,7 @@ function updateMusic(artist, title) {
|
||||||
const sepEl = document.getElementById('musicSep');
|
const sepEl = document.getElementById('musicSep');
|
||||||
const playing = !!(artist || title);
|
const playing = !!(artist || title);
|
||||||
isPlaying = playing;
|
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';
|
document.querySelector('.music-ticker').style.opacity = playing ? '1' : '0';
|
||||||
albumArtEl.style.opacity = playing ? '1' : '0';
|
albumArtEl.style.opacity = playing ? '1' : '0';
|
||||||
if (!playing) {
|
if (!playing) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,15 @@ import org.kde.plasma.plasma5support as Plasma5Support
|
||||||
WallpaperItem {
|
WallpaperItem {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
function applyConfig() {
|
||||||
|
webView.runJavaScript("setShowSkeleton(" + Plasmoid.configuration.ShowSkeleton + ")")
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Plasmoid.configuration
|
||||||
|
function onShowSkeletonChanged() { applyConfig() }
|
||||||
|
}
|
||||||
|
|
||||||
WebEngineView {
|
WebEngineView {
|
||||||
id: webView
|
id: webView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -24,6 +33,10 @@ WallpaperItem {
|
||||||
request.accepted = true
|
request.accepted = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onLoadingChanged: function(loadRequest) {
|
||||||
|
if (loadRequest.status === WebEngineLoadRequest.LoadSucceededStatus)
|
||||||
|
applyConfig()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start CAVA on load
|
// Start CAVA on load
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue