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:
parent
b2df95ed10
commit
5876701a64
4 changed files with 61 additions and 17 deletions
|
|
@ -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) + ")")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue