From 62449c757d5974f1c21e97af7ebfac4f4c4eac42 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 15 Jun 2026 00:19:43 -0600 Subject: [PATCH] fix(slint): remove animated idle cat in SongCard that forced continuous repaint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- crates/qbz-slint/ui/shell/SongCard.slint | 31 ++++++------------------ 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/crates/qbz-slint/ui/shell/SongCard.slint b/crates/qbz-slint/ui/shell/SongCard.slint index 886e0e145..2a2bd7397 100644 --- a/crates/qbz-slint/ui/shell/SongCard.slint +++ b/crates/qbz-slint/ui/shell/SongCard.slint @@ -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 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 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