fix(slint): remove animated idle cat in SongCard that forced continuous repaint

SongCard lives in the always-mounted now-playing bar. Its idle (no-track) state
drew a sleeping cat with two animation-tick()-driven drifting "z"s, which forced
the whole window to repaint at the display rate forever while idle — ~4% CPU on
Linux and ~55% on macOS/Metal on a static Discover screen (Metal's higher
per-frame cost made it egregious). Replace with a static music glyph placeholder
(matches TrackPlayCell). Idle is now lazy (~0 fps).

cc
This commit is contained in:
vicrodh committed 2026-06-15 00:19:43 -06:00
1 parent b03c8fcb5c
commit 43c89a978f
1 file changed
+8 -23
+8 -23
View File
@@ -207,35 +207,20 @@ export component SongCard inherits Rectangle {
image-fit: cover;
}
// Idle: a sleeping cat with drifting "z"s (RunCat at rest).
// Idle (no track): a STATIC album glyph placeholder. Do NOT animate
// anything here — SongCard lives in the always-mounted now-playing
// bar, so any animation-tick()/continuous animation forces the whole
// window to redraw at the display rate forever while idle. The old
// sleeping-cat "zzz" animation did exactly that and pinned the CPU at
// ~4% on Linux / ~55% on macOS-Metal on a static Discover screen.
if !NowPlayingState.has-track: QbzIcon {
source: @image-url("../assets/icons/cat.svg");
source: @image-url("../assets/icons/music.svg");
width: root.art-size * 0.5;
height: root.art-size * 0.5;
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px + root.art-size * 0.06;
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
tint: Theme.text-muted;
}
if !NowPlayingState.has-track: Text {
property <float> ph: Math.mod(animation-tick() / 1ms, 2200) / 2200;
text: "z";
x: root.art-size * 0.60 + self.ph * 5px;
y: root.art-size * 0.34 - self.ph * 18px;
color: Theme.text-muted;
opacity: 1.0 - self.ph;
font-size: 8px + self.ph * 4px;
font-italic: true;
}
if !NowPlayingState.has-track: Text {
property <float> ph: Math.mod(animation-tick() / 1ms + 1100, 2200) / 2200;
text: "z";
x: root.art-size * 0.66 + self.ph * 5px;
y: root.art-size * 0.30 - self.ph * 18px;
color: Theme.text-muted;
opacity: 1.0 - self.ph;
font-size: 8px + self.ph * 4px;
font-italic: true;
}
// Fetch overlay: while the requested track is resolving/downloading
// (no audio yet), dim the cover and show the spinner so the click is