Add real-time CAVA audio visualizer for VU bars

CAVA runs in background via cava-start.sh, writing bar values to
/tmp/skeledance_bars. A new QML DataSource polls that file at 80ms
and calls updateBars() in JS. Falls back to rest state when not playing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ltadeu6 2026-06-07 09:35:35 -03:00
parent b2df95ed10
commit 5876701a64
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D
4 changed files with 61 additions and 17 deletions

View file

@ -24,6 +24,14 @@ WallpaperItem {
}
}
// 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
@ -42,4 +50,19 @@ WallpaperItem {
)
}
}
// Polls CAVA bars at ~60fps
Plasma5Support.DataSource {
id: cavaSource
engine: "executable"
connectedSources: ["cat /tmp/skeledance_bars 2>/dev/null || echo ''"]
interval: 80
onNewData: function(sourceName, data) {
var raw = data["stdout"].trim()
if (raw !== "") {
webView.runJavaScript("updateBars(" + JSON.stringify(raw) + ")")
}
}
}
}