Make the media bar widget label configurable - #8743
Conversation
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.
There was a problem hiding this comment.
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.
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.
|
Thanks — both points addressed. Separator excluded from the width budget ( Correct, and the overflow was worse with a custom separator as you noted. The fixed 65/35 shares consumed the whole budget before 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)
No automated coverage ( Also correct — the contract fixture injects 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.
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 theBarWidgetbase. This adds four tunables to its inlineshell.jsonentry, following the pattern the clock already uses.scrolltruefalsestops the label sliding and truncates it insteadseparator" · "maxLabelWidth180iconGap6Defaults reproduce the previous hardcoded behaviour, so an entry without them renders exactly as before.
Why the static mode splits the label
Eliding
title + separator + artistas 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. Withscroll: falsethe title and artist now elide against their own share of the budget instead, so both stay readable: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— passtest/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:scroll: false— label static (zero pixel diff across 3s), title elided, artist intactseparatorandmaxLabelWidth— both applied as configurediconGap: 18— glyph-to-text gap measured at 18.4 logical px, against 6 at the default