From 531d1aa0aadee1de87f97ea74526ac8a1216d97e Mon Sep 17 00:00:00 2001 From: jim kolpack Date: Sat, 10 Oct 2026 16:18:00 -0400 Subject: [PATCH] Split show and DJ name onto separate rows at 2x Show names can run up to ~60 characters -- nowhere close to fitting even at 2x's doubled width, so that line stays a Marquee regardless. DJ/host names are assumed short enough to just fit without scrolling, so that line is centered static text instead, using the same codepoints()-based length check and Marquee fallback already established for time_temp (a bare len() would overcount any multi-byte character in the name). 2x only, per explicit scope check -- splitting into two rows needs a spare vertical row that doesn't exist at 1x's tighter layout; 1x keeps the existing single combined show+host Marquee line unchanged. An empty-host placeholder box keeps the row position fixed when no DJ is credited, matching the existing "always render both rows, even empty" rationale for show/host already noted above. Verified against live data (activeShow currently null): empty show line, host line ("Marlowe") correctly centered on its own row, no vertical overflow. --- subwave_nowplaying.star | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index 939d8d3..2f52eaf 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -219,6 +219,26 @@ def main(config): if now["host"]: show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = colors["accent"])) + # At 2x only (there's no spare vertical row for this at 1x): split + # show and host onto their own lines instead of sharing one. Show + # names can run up to ~60 characters -- nowhere near fitting even at + # 2x's doubled width, so that line stays a Marquee regardless. Host + # (DJ) names are assumed short enough to just fit, so that line is + # centered static text instead -- but guarded with the same + # codepoints()-based length check and Marquee fallback used for + # time_temp (see its own comment for why a bare len() would be + # wrong), rather than trusting "always fits" outright. + host_text = render.Text(now["host"], font = "tom-thumb", color = colors["accent"]) if now["host"] else None + host_char_count = len(list(now["host"].codepoints())) if now["host"] else 0 + host_fits = host_char_count <= 15 + if host_text == None: + host_line = render.Box(width = text_width, height = 6) # empty placeholder -- keeps the row count/position fixed even with no host credited + elif host_fits: + host_pad_left = max(0, (text_width - int(host_char_count * 3.9)) // 2) + host_line = render.Padding(pad = (host_pad_left, 0, 0, 0), child = host_text) + else: + host_line = render.Marquee(width = text_width, child = host_text) + 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 @@ -274,13 +294,20 @@ def main(config): # as before). title_font = "terminus-16" if scale == 2 else "tb-8" + show_lines = ( + [ + render.Marquee(width = text_width, child = render.Text(now["show"], font = "tom-thumb", color = colors["text"])), + host_line, + ] + if scale == 2 else + [render.Marquee(width = text_width, child = render.Row(children = show_host_row))] + ) + top_lines = [ render.Marquee(width = text_width, child = render.Text(now["title"], font = title_font, 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)), - time_temp_line, - ] + ] + show_lines + [time_temp_line] children = [render.Column(children = top_lines)] if progress != None: