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.
This commit is contained in:
poprhythm committed 2026-10-10 16:18:00 -04:00
1 parent 547003fde1
commit 531d1aa0aa
1 file changed
+30 -3
+30 -3
View File
@@ -219,6 +219,26 @@ def main(config):
if now["host"]: if now["host"]:
show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = colors["accent"])) 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"]) 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 # 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). # as before).
title_font = "terminus-16" if scale == 2 else "tb-8" 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 = [ 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["title"], font = title_font, color = colors["text"])),
render.Marquee(width = text_width, child = render.Text(now["artist"], 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.Box(width = text_width, height = scale, color = colors["separator"]),
render.Marquee(width = text_width, child = render.Row(children = show_host_row)), ] + show_lines + [time_temp_line]
time_temp_line,
]
children = [render.Column(children = top_lines)] children = [render.Column(children = top_lines)]
if progress != None: if progress != None:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.