commit c5668b8d62e9d50be4f06c4469669b155ed2b984 Author: ltadeu6 Date: Sun Jun 7 07:11:26 2026 -0300 Initial commit — DANCEBOT-9000 KDE Plasma wallpaper plugin Co-Authored-By: Claude Sonnet 4.6 diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..4f3bd45 --- /dev/null +++ b/CLAUDE.md @@ -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 | `` + `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 ``, 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`. diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..1c52926 --- /dev/null +++ b/install.sh @@ -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" diff --git a/plugin/contents/ui/dancer.html b/plugin/contents/ui/dancer.html new file mode 100644 index 0000000..7eb03dd --- /dev/null +++ b/plugin/contents/ui/dancer.html @@ -0,0 +1,1050 @@ + + + + + + + + +
+ + +
+
+
+ + + + + +
+ + +
+
+
+ + +
D A N C E B O T — 9 0 0 0
+ + +
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+ + +
+ + +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+
+ + +
+ + +
+ + NOW PLAYING +
+ — — +
+
+ + +
+ +
+ + + + + diff --git a/plugin/contents/ui/main.qml b/plugin/contents/ui/main.qml new file mode 100644 index 0000000..aa4b303 --- /dev/null +++ b/plugin/contents/ui/main.qml @@ -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) + ")" + ) + } + } +} diff --git a/plugin/metadata.json b/plugin/metadata.json new file mode 100644 index 0000000..053ab31 --- /dev/null +++ b/plugin/metadata.json @@ -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" +} diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..3060d67 --- /dev/null +++ b/uninstall.sh @@ -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."