-
Notifications
You must be signed in to change notification settings - Fork 95
fix(music): prevent popup from closing during track changes #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Changes behavior to keep popup open when switching tracks. - Popup no longer closes on next/prev track - Widget remains visible but empty when player is stopped (e.g. closed) Note: Does not distinguish between stop and track change events. As a consequence, **the bar widget is always visible (even if empty)**. This could be improved with a delay-based approach if needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
Issue: playing next/prev track hides the popup, regardless of whether it's next/prev via ironbar or another way. Why: next/prev track events are coupled with a transient So we just don't hide the widget. The caveat is that we cannot distinguish between a transient stop on next/prev and an "actual" stop, e.g. closing the player. So we just empty the label. As a consequence the popup doesn't close anymore on actual stop either, but I'd say this is actually more predictable UX. Less good is that there is now constantly an empty-label bar widget – this could maybe be addressed with adding a delay (say 2000ms) to distinguish between transient and actual stops, but I chose to go with a simpler solution for now and hear your opinion @JakeStanger. |
|
I think the button needs to be properly hidden when nothing is playing, as otherwise styling is going to cause it to show as a small empty box in many cases. The timeout approach sounds like the right way to go to me, although 2000ms sounds excessive (how long is the delay between the events, I'd imagine almost instant?). You should just be able to hold onto a glib timeout which hides the button on stop, and clear that timeout on any other relevant event. |
Implements timeout-based detection to keep popup open during track changes while properly hiding the button when the player is actually closed. When PlayerState::Stopped is received: - Clear label and icons immediately (visual feedback) - Schedule button hide after 500ms timeout - If new track/state arrives before timeout, cancel and stay visible - If timeout fires, hide button and close popup This prevents the popup from closing during track changes (transient stops) while still hiding the button when the player is truly closed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
I set it to 500ms for now, but it would occasionally still hide unintended, which sort of… defeats the whole point, leading to unpredictable UX. I think ideally we would just decouple popup visibility from button visibility, but it's not something I looked into yet. |
Yeah okay agreed, this sounds worse. The popup is closed here, inside the module code: ironbar/src/modules/music/mod.rs Lines 237 to 239 in 25d6e95
To me this feels bad already - why is the bar widget code responsible for hiding the popup? That should probably be in the controller. Moving the check up to there is probably most of the work in decoupling the two. |
|
If I just comment out all Lines 79 to 81 in ca391df
There is no |
|
Also as for delays, I now realize there might simply not be any "correct" value because next/prev track metadata would be preceded by I/O 😆 : And IO operation duration is unpredictable. |
Ah right of course. Gone are the days of popups being free floating separate windows.
Do we know whether the Otherwise, as much as I don't like it, I think a delay is the best possible answer. We'd need to pick a value large enough that any reasonable I/O would have kicked off in that time, and then worst-case if I/O takes an unusually long period of time, the (currently empty anyway) popup closes and has to be reopened. |
|
I will most likely be away from Linux for quite some time, so this one is on hold for now :) |
|
No worries |
Changes behavior to keep popup open when switching tracks.
Note: Does not distinguish between stop and track change events. As a consequence, the bar widget is always visible (even if empty). This could be improved with a delay-based approach if needed.
🤖 Generated with Claude Code