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)]