Tie animations to playback state
- Paused/stopped playerctl treated as no music (QML change) - Character and notes only appear when Playing - VU meter always visible but in rest state (3px, faint) when idle Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b6eb089c2c
commit
2ee2470089
2 changed files with 19 additions and 14 deletions
|
|
@ -28,14 +28,15 @@ WallpaperItem {
|
|||
Plasma5Support.DataSource {
|
||||
id: musicSource
|
||||
engine: "executable"
|
||||
connectedSources: ["playerctl metadata --format '{{artist}}||{{title}}' 2>/dev/null || echo '||'"]
|
||||
connectedSources: ["playerctl metadata --format '{{status}}||{{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
|
||||
var raw = data["stdout"].trim()
|
||||
var parts = raw.split("||")
|
||||
var status = parts[0] || ""
|
||||
var artist = status === "Playing" ? (parts[1] || "") : ""
|
||||
var title = status === "Playing" ? (parts[2] || "") : ""
|
||||
webView.runJavaScript(
|
||||
"updateMusic(" + JSON.stringify(artist) + "," + JSON.stringify(title) + ")"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue