spotify-player: inset the special workspace window; keep cava on with playback
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
d1c92394e5
commit
016b9bdd48
2 changed files with 28 additions and 8 deletions
|
|
@ -6191,16 +6191,21 @@ in
|
|||
return Math.floor(s / 60) + ":" + ("0" + Math.floor(s % 60)).slice(-2);
|
||||
}
|
||||
|
||||
// Live spectrum for the media cards' rings. cava runs only
|
||||
// while this popup is open AND something is playing, so it
|
||||
// isn't capturing audio in the background. levels is a
|
||||
// barCount-long array of 0-100 ints, one frame per tick.
|
||||
// Live spectrum for the media cards' rings. Tied to playback
|
||||
// rather than to the popup: gating on `open` restarted cava
|
||||
// on every open, and its bars ramp up from flat, so the
|
||||
// ring visibly booted each time instead of being mid-song
|
||||
// when it appeared. The cost is cava capturing while the
|
||||
// popup is closed, but only ever while something is
|
||||
// actually playing. levels is a barCount-long array of
|
||||
// 0-100 ints, one frame per tick.
|
||||
readonly property int barCount: 24
|
||||
property var levels: []
|
||||
|
||||
Process {
|
||||
id: cavaProc
|
||||
running: calPopup.open && calPopup.players.length > 0
|
||||
running: calPopup.players.some(
|
||||
p => p.playbackState === MprisPlaybackState.Playing)
|
||||
command: [Commands.cava, "-p", Commands.cavaConfig]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
|
|
@ -6215,9 +6220,10 @@ in
|
|||
}
|
||||
}
|
||||
|
||||
// Bars decay to flat when cava stops, so a paused card
|
||||
// doesn't keep the last frame frozen around the disc.
|
||||
onOpenChanged: if (!open) levels = []
|
||||
// Clear on the last frame of playback, not on close: cava
|
||||
// now outlives the popup, so wiping on close would throw
|
||||
// away the live frames it is still producing.
|
||||
onPlayersChanged: if (!cavaProc.running) levels = []
|
||||
|
||||
Row {
|
||||
id: calRow
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue