omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Media bar widget marquee freezes mid-scroll, showing only a few leading characters

Open schotime opened this issue 3 months ago • 7 comments

What happened

The omarchy.media bar widget's marquee (the scrolling now-playing label) gets permanently stuck showing only the first few characters of the track title — e.g. ⏸ For instead of ⏸ For Evigt · Volbeat, or ⏸ Giv instead of ⏸ Give It Up · Midtown — with no scrolling motion at all, sometimes for the lifetime of the shell process.

Expected behavior

When the combined "title · artist" label is wider than the widget's maxLabelWidth (180px), it should marquee-scroll continuously. When it's narrower, it should just display in full, static, left-aligned.

Root cause

BarWidget.qml drives the label's horizontal position with a property-value- source animation:

NumberAnimation on x {
  id: scrollAnim
  running: labelText.needsScroll && !root.popupOpen && !root.bar.vertical
  loops: Animation.Infinite
  duration: Math.max(6000, labelText.implicitWidth * 25)
  from: scrollClip.width
  to: -labelText.implicitWidth
  easing.type: Easing.Linear
}

A NumberAnimation on <property> is a value source: while running is true it owns x outright, but the instant running flips to false — because the track changed to something short enough that needsScroll goes false, the popup opened, or the bar rotated to vertical — it simply freezes x at whatever mid-scroll offset it happened to be at. Nothing ever resets it back to 0.

Since scrollClip clips its contents (clip: true) and the label's x is left sitting at some large offset (observed live via a temporary IPC probe: x=130 inside a 165px-wide clip, for a 165px-wide label — i.e. it should never have been scrolling in the first place, needsScroll was correctly false, but x was stale from an earlier scroll cycle), only the last clipWidth - x pixels of the clip are visible, which land on the very leftmost glyphs of the label — a thin sliver of the string's start, not the full text and not a scroll.

This reproduces reliably any time the active/selected MPRIS source changes between tracks of different lengths, or the popup is opened/closed while the label is mid-animation. It survives omarchy restart shell because it's deterministic given the metadata at hand — a fresh process ends up in the same stuck state on its own once a track transitions from needing-to-scroll to not.

Proposed fix

Reset x explicitly whenever the animation stops, so the label always returns to a clean left-aligned resting position:

         NumberAnimation on x {
           id: scrollAnim
           running: labelText.needsScroll && !root.popupOpen && !root.bar.vertical
           loops: Animation.Infinite
           duration: Math.max(6000, labelText.implicitWidth * 25)
           from: scrollClip.width
           to: -labelText.implicitWidth
           easing.type: Easing.Linear
+          onRunningChanged: if (!running) labelText.x = 0
         }

Verified fix in a local plugin clone (omarchy plugin clone omarchy.media) — confirmed via screenshots taken a few seconds apart that after the patch the label reliably shows the full static text when short, and genuinely scrolls (not frozen) through the whole "title · artist" string when long.

File: shell/plugins/services/media/BarWidget.qml

Steps to reproduce

  1. Have two MPRIS sources active at once (e.g. a browser tab playing audio + a Deezer/Spotify client), or just let a single source's track change.
  2. Let the bar's media widget scroll through a title/artist combo longer than 180px.
  3. Let the track change to something shorter (or open/close the widget's popup) while it's mid-scroll.
  4. The label freezes, showing only a few leading characters of the new title, and never scrolls or corrects itself again.

System details

  • Omarchy: 4.0.0-1 (stable channel)
  • Hyprland: 0.56.2 (Wayland)
  • Kernel: Linux 7.1.8-arch1-3
  • Hardware: Dell XPS 15 9560, i7-7700HQ, GTX 1050 Mobile / HD Graphics 630 (hybrid GPU)
  • Display: 3840x2160 @ 2x, 16", 60Hz

Attachments

Screenshots showing the stuck state and the working scroll after the fix are available locally and will be attached to the issue.

schotime avatar Aug 16 '26 02:08 schotime

Confirming this on 4.0.0-1. Adding evidence that there is a second, independent mechanism behind the same symptom: the proposed onRunningChanged: if (!running) labelText.x = 0 fixes one of the two, but leaves the widget frozen in the other.

Second mechanism: the animation latches from/to at start, and can latch 0 → 0

running is driven by needsScroll (derived from labelText.implicitWidth), while from/to/duration derive from scrollClip.width and implicitWidth. Those bindings do not settle in the same evaluation pass. Logging the exact instant running flips true, for a title arriving after an empty one:

>> runningChanged -> true   AT THIS INSTANT: from=0.0 to=0.0 duration=6000 | implicitW=363.8 clipW=0.0
!! DEGENERATE: from == to, this animation can never move x
   settled: from=180.0 to=-414.7 running=true x=0.0   <- x never moves again

NumberAnimation latches from/to when it starts. scrollClip.width is still 0 at that moment, so the animation starts as a degenerate 0 → 0 and loops that forever. The bindings correct to 180 / -414.7 a frame later, but changing from/to on an already-running animation does not restart it — so the label sits motionless showing the first maxLabelWidth px of the string, with running=true and needsScroll=true, for the lifetime of that track.

That last part is the tell: in this mode the widget is stuck while needsScroll is true, so a reset keyed on running going false never fires.

This also seems to explain the "survives omarchy restart shell" observation in the report — on a fresh shell the title goes "" → long, which is exactly the transition that latches the degenerate values.

Isolated reproduction

I replicated the scrollClip / labelText / scrollAnim block in plain QtQuick (no Quickshell) and drove the transitions, sampling x every 60 ms. Same scenarios across both patch variants:

transition with onRunningChanged: if (!running) x = 0 only with both fixes
"" → long (shell start, media already playing) FROZEN xRange=[0.0..0.0] scrolls
long → "" → long (track gap / player stops) FROZEN xRange=[0.0..0.0] scrolls
long → long (plain track change) FROZEN xRange=[0.0..0.0] scrolls
short → long scrolls scrolls
popup open / close pauses / resumes pauses / resumes
long → short parks at x = 0 fixed fixed

Unpatched stock code froze identically on "" → long and long → "" → long.

The long → long row is worth calling out: once a degenerate animation is running it never restarts on its own, so every subsequent track change inherits the frozen animation. That matches "sometimes for the lifetime of the shell process".

Suggested addition

Arm the animation a tick later, so it only ever starts once the width bindings have settled, and re-arm on every text change:

property bool needsScroll: implicitWidth > scrollClip.width

property bool scrollArmed: false
function rearmScroll() { scrollArmed = false; Qt.callLater(armScroll) }
function armScroll() { scrollArmed = true }
onImplicitWidthChanged: rearmScroll()
Component.onCompleted: rearmScroll()

// the defect this issue already identifies
onNeedsScrollChanged: if (!needsScroll) x = 0

NumberAnimation on x {
  id: scrollAnim
  running: labelText.scrollArmed && labelText.needsScroll && !root.popupOpen && !root.bar.vertical
  loops: Animation.Infinite
  duration: Math.max(6000, labelText.implicitWidth * 25)
  from: scrollClip.width
  to: -labelText.implicitWidth
  easing.type: Easing.Linear
}

I keyed the reset on needsScroll rather than running so that opening the popup pauses the marquee in place instead of snapping it back to the start — but that is cosmetic, and onRunningChanged as proposed works equally well for the clipping defect.

Verified live in a clone (omarchy plugin clone omarchy.media), instrumented to sample labelText.x at shell startup — the case that previously froze:

SCROLLCHECK needsScroll=true armed=true running=true implicitW=287.5 clipW=180.0
            xRange=[-14.6..147.8] => SCROLLING

File: shell/plugins/services/media/BarWidget.qml

Environment: Omarchy 4.0.0-1, Hyprland 0.56.2, Quickshell 0.3.0, kernel 7.1.8-arch1-3, Intel i5-9400F / RTX 2060, single 1080p monitor.

y4nder avatar Aug 18 '26 04:08 y4nder

A third property of the same running expression, orthogonal to both freeze mechanisms above: it never consults playback state, so the marquee keeps animating while media is paused — indefinitely, at full frame rate.

running: labelText.needsScroll && !root.popupOpen && !root.bar.vertical

needsScroll is derived purely from implicitWidth, and title/artist come from activePlayer.trackTitle/trackArtist, which persist across a pause. So a paused player with a title wider than maxLabelWidth scrolls forever with nothing playing.

Cost

Measured on a clone (omarchy plugin clone omarchy.media), both MPRIS players Paused, label ~50–64 chars, two displays:

shell state quickshell CPU RSS
clone with the stock marquee, media paused 18.6% 733 MB
after omarchy restart shell (no code change) 19.2% 614 MB
marquee block replaced with elide: Text.ElideRight 3.4% 612 MB
widget removed from the bar entirely 3.1% 598 MB

The restart row is the one I'd flag: a fresh shell process draws the same ~19% within seconds, so this is steady-state cost, not drift or a leak. Deleting only the NumberAnimation on x block, with everything else untouched, accounts for ~15 points of it — roughly 82% of the shell's total CPU.

Thread breakdown while it ran:

quickshell (main)   8.0%
QSGRenderThread     4.8%
QSGRenderThread     4.4%     <- one per display
Wayland threads     1.2% + 1.0%

Two hot scene-graph render threads is the signature of a continuous per-frame repaint rather than an expensive poll — consistent with a linear NumberAnimation driving x from the GUI thread.

Why this matters for the fixes proposed above

The two mechanisms documented in this thread leave the animation frozen, and a frozen animation is cheap — a degenerate 0 → 0 loop writes the same x every tick, so the scene graph has nothing to repaint. Both proposed patches make those cases genuinely scroll again.

That is the correct fix for the visual defect, but it means users currently sitting in the frozen state are getting low CPU because of the bug, and will inherit the marquee's real cost once it's fixed — including while paused. I'd suggest pairing either patch with a playback-state term so the fix doesn't land as a battery regression:

-  running: labelText.scrollArmed && labelText.needsScroll
-    && !root.popupOpen && !root.bar.vertical
+  running: labelText.scrollArmed && labelText.needsScroll
+    && root.activePlayer && root.activePlayer.isPlaying
+    && !root.popupOpen && !root.bar.vertical

Worth noting the sibling first-party widget already treats this as a cost-sensitive path — quickshell.spotify's marquee uses an XAnimator with an explicit comment about keeping it off the main thread, plus a user-facing scrollBarText on/off toggle. An XAnimator here would likely be cheaper than NumberAnimation for the same reason, though I haven't measured that variant.

Caveat on my numbers

I could not reproduce this on unmodified omarchy.media. On my machine the stock widget renders nothing at all — hasMedia is false and activePlayer is null, paused or playing (verified by screenshot and by MPRIS PlaybackStatus), so the marquee never starts and the shell sits at ~1.5%. I tried it three ways: swapping the widget in the bar layout, and with my clone's directory moved out of the tree entirely to rule out the moduleName: "omarchy.media" collision (a clone doesn't rename moduleName, which will silently collide with the built-in if both are enabled — possibly worth its own issue).

So every number above comes from a clone whose Service.qml and MediaModel.js are byte-identical to stock, and whose scroll block diffs clean against shell/plugins/services/media/BarWidget.qml. The clone's only relevant deviation is its service lookup:

readonly property var mediaService: bar?.shell?.serviceFor("<clone-id>")
  || bar?.shell?.firstPartyServiceFor("omarchy.media")

which looks like a workaround for #7355. If that fallback is what gives the clone a live activePlayer where stock has none, then the paused-scroll cost may only be reachable on cloned setups today — and #7355 would be the more fundamental bug. Someone whose stock media widget actually renders could confirm in seconds: pause a track with a long title and watch quickshell in top.

Environment: Omarchy 4.0.1-1, Hyprland 0.56.2, Quickshell 0.3.1, kernel 7.1.9-arch1-2, Intel Core Ultra 7 258V / Arc 140V, dual display (2880x1800 + 3840x2160, both @60Hz, scale 1.6), horizontal bar.

srikat avatar Aug 26 '26 08:08 srikat

Correction to one parenthetical in my comment above: I described a clone keeping moduleName: "omarchy.media" as a silent collision "possibly worth its own issue." That's wrong — it's intended behavior, and I should have checked before writing it.

omarchy-plugin-clone rewrites .id, .name and .barWidget.displayName in the manifest and stamps omarchy.clonedFrom, but deliberately leaves built-in ids inside the plugin's QML alone:

# Keep built-in ids inside the plugin code as stable IPC targets. The shell
# uses clonedFrom to route those calls to this local manifest id.

So the stable built-in id is the contract, with clonedFrom as the routing mechanism — not an oversight. Please disregard that clause; there's no separate issue to file there.

I'd also implied the collision might explain why stock omarchy.media renders nothing on my machine. It doesn't: one of my reproduction attempts had the clone moved out of the plugins directory entirely, so no collision was possible, and stock still rendered nothing whether paused or playing. That failed reproduction remains unexplained by anything I've shown, and #7355 (firstPartyServiceFor() missing clonedFrom routing) looks like the more likely direction.

The rest of the comment stands as written — the measurements, the render-thread breakdown, the note that a frozen animation is cheap so both proposed patches will surface the marquee's real cost, and the caveat that all of it was measured on a clone rather than on stock.

srikat avatar Aug 26 '26 08:08 srikat

Confirming the marquee CPU cost on the unmodified stock omarchy.media widget. This fills the stock-widget caveat in the existing cost analysis above.

Environment

  • Omarchy: 4.0.1-1
  • Quickshell: 0.3.1-1
  • Hyprland: 0.56.2
  • Kernel: 7.1.8-arch1-3
  • Wayland, NVIDIA, dual 1920×1080 @ 60 Hz displays
  • MPRIS sources: Chromium (Stopped) and Cliamp (Paused)
  • Cliamp exposed a long title · artist label, so needsScroll was true
  • Stock first-party plugin; no media clone was active

Controlled A/B result

I restarted the shell between cases and sampled process CPU from /proc/<pid>/stat rather than relying on lifetime ps %CPU:

case Quickshell CPU
stock media widget present, long paused track ~19%
only omarchy.audio disabled 18.67%
omarchy.media disabled 0.17%
media service enabled, but omarchy.media removed only from the bar layout 0.17%
final 10-second sample with service enabled/widget absent 0.00%

Disabling the third-party agents widget made no meaningful difference. Disabling the dynamic-widget group dropped the shell to essentially zero, and bisection isolated omarchy.media; keeping the media service alive while removing only BarWidget.qml from the layout confirmed the hot path is the widget/marquee, not MPRIS or PipeWire service tracking.

The long track was paused, so the infinite NumberAnimation on x was continuously rendering despite no playback.

Implication for #7512

The re-arm/reset changes in #7512 address the frozen/parked visual states, but a frozen animation is comparatively cheap. Making the marquee reliably animate can expose this steady-state ~19% cost more consistently, including while paused.

I recommend pairing the visual fix with at least a playback-state gate:

running: labelText.scrollArmed
  && labelText.needsScroll
  && root.activePlayer
  && root.activePlayer.isPlaying
  && !root.popupOpen
  && !root.bar.vertical

A user-facing static mode would also address the underlying continuous-render tradeoff—e.g. labelMode: "elide" | "marquee" | "hidden", as discussed in #6901. If marquee remains available, XAnimator is worth measuring against NumberAnimation so the animation is not driven on the main QML thread.

Local mitigation was to remove only omarchy.media from the bar layout while leaving the media service enabled; Quickshell then returned to effectively idle CPU.

EmpireOperating avatar Aug 29 '26 20:08 EmpireOperating

Confirming this is still present on 4.0.4-1. Also saw a related symptom: after a long title scrolls and the track then changes to a short title that fits without scrolling, the label doesn't reset to x:0 — it stays offset from wherever the marquee animation last stopped, so the (short) title renders shifted/partly outside its clip box instead of showing normally. Looks like the same root cause (the marquee's x position never gets reset when needsScroll goes false).

mickes66 avatar Sep 18 '26 20:09 mickes66

Still reproduces on 4.0.4-1 (quickshell 0.3.1-1, Ryzen 5 PRO 4650U / Radeon Vega). Another trigger: lock → unlock. The bar gets rebuilt on unlock (every widget logs IpcHandler … another handler is registered). The new widget goes through the "" → long transition, starts as the degenerate 0 → 0 animation described above, and stays frozen until the shell restarts.

D4RK0N3dev avatar Sep 21 '26 11:09 D4RK0N3dev

This is still present on quattro (902fd8a). In shell/plugins/services/media/BarWidget.qml, NumberAnimation on x leaves labelText.x wherever it stopped. The only reset is onRunningChanged: if (!running && Style.reduceMotion) labelText.x = 0, so with reduced motion off, a long title followed by a short one leaves the short one parked partly outside scrollClip. That part is proven in source.

The second mechanism y4nder describes, where the animation starts before scrollClip.width settles and latches bad from/to values, is plausible from the bindings but I could not establish it from source alone. Qt 6.4 and later apply from/to changes to a looping animation on its next loop, which suggests one bad loop rather than a permanent freeze. The reports of it staying frozen after shell start and lock/unlock point the other way. On a worker, with the real widget and a fake MPRIS player, quattro held the label on its first characters for over 6 seconds after a shell restart in 6 of 6 tries. The fix scrolled from the first frame in 6 of 6. So the startup freeze is real either way, whether or not it lasts past the first loop.

#7512 fixes this issue and is linked to it, so it closes when that merges. It resets x when the label stops needing to scroll, and arms the animation one tick after every width change. It was worked as its own item and verified on a worker at 2ed4a80: the freeze reproduced on quattro, was gone with the fix, and came back with the fix reverted. Other open pull requests fix the same bug in different ways: #9120, #12776 and #14300. #7512 is the oldest and the one carrying ready, so the others are left for the maintainer to compare against it.

The marquee animating while playback is paused, raised in the comments here, is a separate defect from the freeze, because running never looks at isPlaying. It is tracked in #12615 and fixed in #12963.

Claude Opus 5.5 diagnosed this issue from source and ran nothing new for it; the worker results above come from #7512's own verification. Codex Medium reviewed it as a second opinion and agreed that the missing reset is real and that the paused-playback cost is separate. It contributed the point about Qt applying endpoint changes on the next loop, and it read the published quattro file rather than this checkout. Next step: the maintainer decides on #7512.

omarchybot avatar Oct 08 '26 05:10 omarchybot