From fdb2a1038e3630223461e616f6ebe68617880027 Mon Sep 17 00:00:00 2001 From: jim kolpack Date: Sat, 10 Oct 2026 14:44:57 -0400 Subject: [PATCH] At 2x, show time/temp as static text instead of scrolling it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First experiment in using 2x's extra width for something other than just stretching the 1x layout: the time/temp line usually fits without scrolling once the text column doubles in width. Marquee is unneeded overhead for short, non-truncated text. Guarded by a length check (<=15 chars), not just scale==2: pixlet has no way to measure rendered text width from within Starlark, and tom-thumb is variable-width, so this is a heuristic rather than an exact fit check. Measured via the CLI: a realistic worst case like "12:59 pm · 100°F" (16 chars -- 2-digit hour, 3-digit temp) renders at 63px against a 64px budget, just 1px of margin -- too close to rely on. 15 chars keeps a real margin (59px measured) against overflowing into the art column. Falls back to Marquee past that length, and always at 1x regardless of length (tighter width there either way). --- subwave_nowplaying.star | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index 4ebd486..11df999 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -219,12 +219,29 @@ def main(config): if now["host"]: show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = colors["accent"])) + time_temp_text = render.Text(now["time_temp"], font = "tom-thumb", color = colors["meta"]) + + # At 2x, the extra width usually fits e.g. "9:54 pm \xb7 65\xb0F" without + # scrolling -- tried as a first, contained experiment in using 2x's + # extra room rather than just stretching the same 1x layout. But + # tom-thumb is variable-width and pixlet has no way to measure + # rendered text width from within Starlark, so this is a length + # heuristic, not an exact fit check: measured via the CLI, + # "12:59 pm \xb7 100\xb0F" (16 chars, a realistic worst case -- 2-digit + # hour, 3-digit temp) comes out to 63px against a 64px budget, 1px of + # margin; "11:59 am \xb7 -5\xb0F" (15 chars) is a safer 59px. Capping at + # 15 chars keeps a real margin against overflowing into the art + # column instead of relying on a 1px coincidence. Always Marquee at + # 1x, where the available width is tighter regardless of length. + time_temp_fits = scale == 2 and len(now["time_temp"]) <= 15 + time_temp_line = time_temp_text if time_temp_fits else render.Marquee(width = text_width, child = time_temp_text) + top_lines = [ render.Marquee(width = text_width, child = render.Text(now["title"], font = "tb-8", color = colors["text"])), render.Marquee(width = text_width, child = render.Text(now["artist"], font = "tb-8", color = colors["text"])), render.Box(width = text_width, height = scale, color = colors["separator"]), render.Marquee(width = text_width, child = render.Row(children = show_host_row)), - render.Marquee(width = text_width, child = render.Text(now["time_temp"], font = "tom-thumb", color = colors["meta"])), + time_temp_line, ] children = [render.Column(children = top_lines)]