# YT Music
A small now-playing block for the foot of Herdr's side panel. It shows the track that plays in YouTube Music in Google Chrome: a music icon, the title and the artist, the elapsed and total time with a progress bar, and five round-ish controls. While nothing plays, the block is 0 px tall and you see nothing. When a track starts, it grows to 92 px. macOS only: it runs `osascript` and talks to Chrome through Apple Events.

## What you see
One block, full width of its column, with a 1 px top border (theme `border`) and the theme `background` fill. Text is 12 px, `muted` color. Content is centered vertically, 12 px of padding left and right, 6 px between rows, anything that overflows is clipped. Three rows, top to bottom.
1. **Track.** A Lucide `music` icon (12 px), then the title, then the artist, with 7 px between them. The title is medium weight and the artist is `dim`. Both truncate with an ellipsis; the artist shrinks twice as fast as the title. The icon is `ansi1` while playing and `dim` while paused. The title is `foreground` while playing and `muted` while paused. Hovering the row shows `
ยท `.
2. **Time and bar.** Elapsed time, the bar, total time, 8 px apart, 11 px text. Each time sits in a 34 px box in `dim`, in `m:ss` form (`3:07`; no hours, so 1 h 5 min reads `65:00`). The total is right-aligned. The bar is 4 px high with a 2 px radius, `raised` track, and a fill in `ansi2` while playing or `dim` while paused. The bar width is the block width minus 24 (padding), 68 (two times) and 16 (two gaps), never under 40 px, and it follows the block width when it changes by more than 2 px. Before the first width is known it assumes 360 px. With a total of 0 (a live stream) the fill is empty.
3. **Controls.** Five buttons, centered, 6 px apart, left to right: skip-back (24 px square, 4 px radius, "Previous"), rewind (24 px, "Back 10 s"), play/pause (28 px, fully round with a 14 px radius, `raised` fill, `foreground` icon), fast-forward (24 px, "Forward 10 s"), skip-forward (24 px, "Next"). All icons are 12 px Lucide icons in `muted`; on hover the button fills with `hover` and its icon turns `foreground`. The middle button shows the `pause` icon while playing and `play` while paused, with the tooltip "Pause" or "Play". The pointer is a hand.
Reminder line. When Chrome blocks scripting, the three rows are replaced by one row: a 12 px `music` icon in `dim`, then "Chrome: allow JavaScript from Apple Events" in `dim`, 11.5 px, truncated. Its tooltip reads "Chrome: View > Developer > Allow JavaScript from Apple Events".
Theme. Every color comes from `theme()`, so the block follows the person's theme. With Nightfall: background `#212121`, border `#2a2a2a`, text `muted` `#d6d6d6`, `dim` `#8f8f8f`, `foreground` `#c4c4c4`, `raised` (play button, bar track) `#2b2b2b`, `hover` `#262626`, `ansi1` (playing icon) `#e06c75`, `ansi2` (playing bar fill) `#98c379`.
Block height. 92 px with a track, 36 px with the reminder line, 0 px with nothing to show.
## How it behaves
**Playing.** The title is `foreground`, the icon `ansi1`, the bar `ansi2`, and the middle button shows pause. The elapsed time and the bar move once a second. The mod works out the position as the last known position plus the time since that write, capped at the total.
**Paused.** The title turns `muted`, the icon and the bar fill turn `dim`, the middle button shows play. The clock and bar stand still.
**Nothing plays.** The block is 0 px. This holds when Chrome is not running, when no tab has `music.youtube.com` open, when the page has no `