diff --git a/subwave_nowplaying.star b/subwave_nowplaying.star index 002a57e..771518b 100644 --- a/subwave_nowplaying.star +++ b/subwave_nowplaying.star @@ -245,8 +245,23 @@ def main(config): # scrolling it -- easy to mistake for "the centering didn't work"). time_temp_char_count = len(list(now["time_temp"].codepoints())) time_temp_fits = scale == 2 and time_temp_char_count <= 15 + + # Centered via a computed left Padding, not render.Row(expanded=True, + # main_align="center") -- that version centered the text correctly, + # but Row's `expanded` also grabbed extra *vertical* space from the + # enclosing Column (main_align="space_between"), which pushed the + # progress bar below it out of view. Padding only nudges this one + # line horizontally, so it can't affect the Column's vertical + # distribution the way a flexible/expanding child can. + # + # tom-thumb is variable-width, so this is an estimate (~3.9px/char, + # measured via the CLI against several real time/temp strings), not + # pixel-exact centering -- close enough that it isn't visibly + # off-center for strings in the length range this branch allows. + estimated_text_width = int(time_temp_char_count * 3.9) + pad_left = max(0, (text_width - estimated_text_width) // 2) time_temp_line = ( - render.Box(width = text_width, child = render.Row(main_align = "center", expanded = True, children = [time_temp_text])) + render.Padding(pad = (pad_left, 0, 0, 0), child = time_temp_text) if time_temp_fits else render.Marquee(width = text_width, child = time_temp_text) )