Initial commit — DANCEBOT-9000 KDE Plasma wallpaper plugin

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ltadeu6 2026-06-07 07:11:26 -03:00
commit c5668b8d62
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D
6 changed files with 1220 additions and 0 deletions

59
CLAUDE.md Normal file
View file

@ -0,0 +1,59 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## What this is
A KDE Plasma 6 wallpaper plugin — a dancing retrowave robot (DANCEBOT-9000) that reacts to currently playing music via `playerctl`. No build step, no dependencies to install; the plugin is deployed directly.
Plugin ID: `com.vini.dancingcharacter`
Install path: `~/.local/share/plasma/wallpapers/com.vini.dancingcharacter`
## Deploy / test cycle
```bash
# Install (or reinstall after edits)
./install.sh
# Remove
./uninstall.sh
```
After install, activate via: Right-click desktop → Configure Desktop and Wallpaper → Wallpaper Type → Dancing Character.
Plasma hot-reloads QML changes when you reinstall; for HTML/CSS/JS changes you may need to switch away and back to the wallpaper type to force a reload.
**Runtime requirement**: `QtWebEngine` QML module must be installed (e.g., `qml6-module-qtwebengine` on Debian/Ubuntu). `playerctl` must be running for the music ticker to show track info.
## Architecture
```
plugin/
metadata.json # KPackage/KPlugin descriptor for Plasma 6
contents/ui/
main.qml # Plasma WallpaperItem — hosts everything
dancer.html # Self-contained animation (HTML + CSS + JS)
```
### main.qml — the Plasma host
- Declares a `WallpaperItem` with a full-screen `WebEngineView` pointed at `dancer.html`.
- A `Plasma5Support.DataSource` with `engine: "executable"` runs `playerctl metadata` every 2 s and injects the result into the page with `webView.runJavaScript("updateMusic(...)")`.
- JavaScript is enabled; local file access and local storage are on/off respectively.
### dancer.html — the visual layer
Pure HTML/CSS/JS, no external dependencies. All visuals are self-contained:
| Layer | Technique |
|---|---|
| Starfield | `<canvas>` + `requestAnimationFrame` |
| Nebula blobs, grid floor, horizon | CSS animations |
| DANCEBOT-9000 robot | Pure CSS (divs + `@keyframes`) |
| Chest EQ bars & VU meter | JS-driven `requestAnimationFrame` |
| Music ticker | DOM text set by `updateMusic(artist, title)` (called from QML) |
| Dance style cycling | `data-dance` attribute on `<body>`, toggled by JS every 8 s |
**Tempo anchor**: everything is keyed to 120 BPM (`BEAT_MS = 500 ms`). CSS animation durations for the robot parts use multiples/fractions of 0.5 s, 1 s, or 2 s.
**Dance styles** (cycle order): `bounce → wave → shuffle → moonwalk → spin`. CSS selectors like `[data-dance="spin"] .robot { ... }` override the default animations via `!important`.

35
install.sh Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
PLUGIN_ID="com.vini.dancingcharacter"
INSTALL_DIR="$HOME/.local/share/plasma/wallpapers/$PLUGIN_ID"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "==> Installing Dancing Character wallpaper plugin..."
# Clean previous install
rm -rf "$INSTALL_DIR"
mkdir -p "$INSTALL_DIR"
# Copy plugin files
cp -r "$SCRIPT_DIR/plugin/." "$INSTALL_DIR/"
echo "==> Plugin installed at: $INSTALL_DIR"
echo ""
echo "==> Checking Plasma version..."
PLASMA_VER=$(plasmashell --version 2>/dev/null | grep -oP '\d+\.\d+' | head -1 || echo "unknown")
echo " Plasma: $PLASMA_VER"
# Check if QtWebEngine is available (needed by the plugin)
if ! python3 -c "import subprocess; r=subprocess.run(['qmake6','-query','QT_INSTALL_PLUGINS'],capture_output=True,text=True); p=r.stdout.strip(); import os; found=os.path.exists(p+'/webenginecore') or os.path.exists(p+'/QtWebEngineCore'); exit(0 if found else 1)" 2>/dev/null; then
echo ""
echo "[!] Could not verify QtWebEngine. If the wallpaper shows a blank screen, install it:"
echo " sudo apt install qml6-module-qtwebengine"
fi
echo ""
echo "==> Done! Plugin installed. No need to restart Plasma."
echo ""
echo " To activate the wallpaper:"
echo " Right-click the desktop → Configure Desktop and Wallpaper..."
echo " → Wallpaper Type → Dancing Character → Apply"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
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
WebEngineView {
id: webView
anchors.fill: parent
url: Qt.resolvedUrl("dancer.html")
backgroundColor: "#000814"
settings {
javascriptEnabled: true
localContentCanAccessFileUrls: true
localStorageEnabled: false
}
onContextMenuRequested: function(request) {
request.accepted = true
}
}
// Polls playerctl every 2s and injects music info into the page
Plasma5Support.DataSource {
id: musicSource
engine: "executable"
connectedSources: ["playerctl metadata --format '{{artist}}||{{title}}' 2>/dev/null || echo '||'"]
interval: 2000
onNewData: function(sourceName, data) {
var raw = data["stdout"].trim()
var sep = raw.indexOf("||")
var artist = sep >= 0 ? raw.substring(0, sep) : ""
var title = sep >= 0 ? raw.substring(sep + 2) : raw
webView.runJavaScript(
"updateMusic(" + JSON.stringify(artist) + "," + JSON.stringify(title) + ")"
)
}
}
}

18
plugin/metadata.json Normal file
View file

@ -0,0 +1,18 @@
{
"KPackageStructure": "Plasma/Wallpaper",
"KPlugin": {
"Authors": [
{
"Email": "ltadeu6@gmail.com",
"Name": "Vini"
}
],
"Category": "Wallpaper",
"Description": "Animated dancing robot character — DANCEBOT-9000",
"Id": "com.vini.dancingcharacter",
"License": "GPL-2.0-or-later",
"Name": "Dancing Character",
"Version": "1.0"
},
"X-Plasma-API-Minimum-Version": "6.0"
}

14
uninstall.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
PLUGIN_ID="com.vini.dancingcharacter"
INSTALL_DIR="$HOME/.local/share/plasma/wallpapers/$PLUGIN_ID"
if [ -d "$INSTALL_DIR" ]; then
rm -rf "$INSTALL_DIR"
echo "==> Removed $INSTALL_DIR"
else
echo "==> Plugin not found at $INSTALL_DIR (nothing to remove)"
fi
echo "==> Change your wallpaper in Desktop Settings to complete the uninstall."