Skip to content

Make the media bar widget label configurable - #8743

Open
robi42 wants to merge 4 commits into
omacom:quattrofrom
robi42:media-widget-settings
Open

Make the media bar widget label configurable#8743
robi42 wants to merge 4 commits into
omacom:quattrofrom
robi42:media-widget-settings

Conversation

@robi42

@robi42 robi42 commented Aug 28, 2026

Copy link
Copy Markdown

The media bar widget currently reads no settings at all — its scrolling, separator and label width are hardcoded — even though every widget already has setting() available on the BarWidget base. This adds four tunables to its inline shell.json entry, following the pattern the clock already uses.

Setting Default Effect
scroll true false stops the label sliding and truncates it instead
separator " · " what sits between track and artist
maxLabelWidth 180 how wide the label may get
iconGap 6 space between the play/pause control and the text

Defaults reproduce the previous hardcoded behaviour, so an entry without them renders exactly as before.

Why the static mode splits the label

Eliding title + separator + artist as a single string means a long track title truncates away the artist entirely, which makes the non-scrolling mode much less useful than it looks. With scroll: false the title and artist now elide against their own share of the budget instead, so both stay readable:

Common People - Fu… · Pulp

The shares are constants rather than being derived from text metrics, which keeps each label's width binding clear of its own implicitWidth.

Verification

  • test/shell.d/bar-widget-contract-test.sh — pass (loads every bar widget, including this one)
  • test/shell.d/clock-test.sh, test/shell.d/plugin-clone-test.sh — pass
  • test/shell.d/config-test.sh — one failure, omarchy-pkgs checkout found for PKGBUILD coverage, which reproduces identically on a clean tree with these changes stashed (missing external checkout, unrelated)

Verified in the running UI per agents/skills/visual-verification.md, with a real MPRIS player:

  • default (no settings) — label still scrolls, confirmed by a moving pixel diff across successive captures
  • scroll: false — label static (zero pixel diff across 3s), title elided, artist intact
  • separator and maxLabelWidth — both applied as configured
  • iconGap: 18 — glyph-to-text gap measured at 18.4 logical px, against 6 at the default

Adds scroll, separator, maxLabelWidth, and iconGap to the widget's inline
shell.json entry. Defaults reproduce the previous hardcoded behaviour, so an
entry without them renders exactly as before.

With scroll disabled, the title and artist elide against their own share of
the label budget rather than as one string, so a long track title truncates
instead of pushing the artist out of the label entirely.
Copilot AI balanced review requested due to automatic review settings August 28, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable media-bar label behavior through inline widget settings.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Adds scrolling, separator, width, and icon-gap settings.
  • Adds separate elided title and artist labels for static mode.
  • Documents the new media widget settings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
shell/plugins/services/media/BarWidget.qml Implements configurable media-label layout.
manual/05-the-top-bar.md Documents media widget settings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shell/plugins/services/media/BarWidget.qml Outdated
Comment thread shell/plugins/services/media/BarWidget.qml Outdated
robi42 added 2 commits August 28, 2026 12:41
The static label split the budget on fixed shares, so a short artist left its
remainder unused and the separator was not counted at all, letting the label
exceed maxLabelWidth. The artist now takes its share first and the title
claims what is left, keeping the pair inside the configured width.
The bar-widget contract fixture only injects an empty settings object and
media-test covered the model, so the new settings, the scroll/static branch
gating, and the static width allocation had no automated coverage.
@robi42

robi42 commented Aug 28, 2026

Copy link
Copy Markdown
Author

Thanks — both points addressed.

Separator excluded from the width budget (BarWidget.qml:97)

Correct, and the overflow was worse with a custom separator as you noted. The fixed 65/35 shares consumed the whole budget before sepText was added on top. The artist now takes its share first and the title claims what remains after the separator:

readonly property real separatorWidth: root.artist !== "" ? sepText.implicitWidth : 0
readonly property real artistWidth: Math.min(root.maxLabelWidth * 0.35, artistText.implicitWidth)
readonly property real titleWidth: Math.min(
  Math.max(0, root.maxLabelWidth - separatorWidth - artistWidth), titleText.implicitWidth)

artistWidth never depends on titleWidth, so the pair stays clear of a binding cycle. This also means a short artist hands its slack back to the title instead of leaving it unused. Measured in the running bar with maxLabelWidth: 220 and a long title: label ink span 219 logical px, against 260 under the previous allocation.

No automated coverage (BarWidget.qml:28)

Also correct — the contract fixture injects settings: {} and media-test.sh covered MediaModel.js only. Added 14 assertions to media-test.sh following the source-assertion pattern clock-test.sh uses, including its comment-stripping so a commented-out line can't satisfy a wiring assertion. They cover each setting and its default, the separator wiring, iconGap spacing, the visible gating on both label branches, the animation gate, the static width allocation, and independent elision on title and artist.

Verified the allocation assertion actually fails on regression: reintroducing the fixed 65% title share turns it red, and it passes again once reverted.

The previous defaults were sized for a sliding label, which stays readable
narrow and is set apart from the play/pause control by its own motion. A
static label has to fit what it shows and sits in the same horizontal run as
the control, so maxLabelWidth and iconGap now default wider when scroll is
disabled. Both remain settable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants