Skip to content

Sort dropdown, spacebar toggle, queue loop, Ctrl+Q, and two playback bugfixes - #32

Merged
lstebner merged 4 commits into
mainfrom
fix/sort-dropdown-spacebar-loop-playback
Jul 10, 2026
Merged

Sort dropdown, spacebar toggle, queue loop, Ctrl+Q, and two playback bugfixes#32
lstebner merged 4 commits into
mainfrom
fix/sort-dropdown-spacebar-loop-playback

Conversation

@lstebner

Copy link
Copy Markdown
Owner

Summary

  • Sort-by control now uses a new reusable Dropdown component (extracted from the equalizer's listbox pattern) instead of a native <select>.
  • Space toggles play/pause globally, except when a button/input/textarea/select/contenteditable has focus.
  • Reaching the end of the queue now loops back to the first track and pauses there instead of clearing "now playing".
  • Ctrl+Q closes the window (already equivalent to a full quit) — required granting the core:window:allow-close permission Tauri's ACL denies by default.
  • Fixed a race condition where seeking on the progress bar would visibly jump back to the old position before snapping to the target, caused by clearing local seek state before the backend's confirmation event arrived.
  • Fixed a crash: seeking near the end of a track could panic the audio engine thread (invalid symphonia Time fractional part from incorrect borrow arithmetic), which cascaded into a full process abort.

Test plan

  • cargo test --lib (110 passed, 1 ignored real-library test)
  • npm run check (0 errors)
  • npm run test (4 passed)
  • Manually verified in the running dev app: sort dropdown, spacebar toggle, queue loop-to-start-and-pause, Ctrl+Q quit, and repeated seeking near track end (no crash)

lstebner added 4 commits July 9, 2026 22:03
- Sort-by control now uses a new reusable Dropdown component (extracted
  from the equalizer's listbox pattern) instead of a native <select>.
- Space toggles play/pause globally, except when a button/input/textarea/
  select/contenteditable has focus.
- Reaching the end of the queue now loops back to the first track and
  pauses there instead of clearing "now playing".
- Ctrl+Q closes the window (already equivalent to a full quit), granting
  the core:window:allow-close permission Tauri's ACL denies by default.
Seeking is dispatched fire-and-forget over Tauri IPC, and the backend's
position only reaches the frontend via the ~4Hz playback-progress event.
Clearing the "seeking" flag immediately on commit raced that event: the
bar would flash back to the stale pre-seek position before snapping
forward once the real update arrived. Now it holds the optimistic
position until an incoming snapshot lands within tolerance of the
target, with a fallback timeout in case a seek silently fails.
Seeking near the end of a track nudges the target time back by a small
epsilon; when that subtraction underflowed the fractional-second part,
the borrow-a-second correction computed 1.0 - frac on an already-negative
frac, producing values like 1.00005. That violates symphonia's
Time::frac invariant of [0.0, 1.0) and panicked deep in
TimeBase::calc_timestamp, which poisoned rodio's sink mutex in the audio
callback thread and cascaded into a full process abort. Fixed to
1.0 + frac and added unit tests covering the failing case.
- Guard the spacebar handler against OS auto-repeat: player.snapshot.state
  only updates from the backend's ~4Hz playback-progress event, so a held
  key would re-read stale state and spam the same toggle command.
- Document why poll_queue_advance's no-queue branch no longer sends an
  MPRIS Stopped notice: sink and queue are always paired, so it's
  unreachable today, kept only to keep last_sink_len in sync.
@lstebner
lstebner enabled auto-merge (squash) July 10, 2026 05:17
@lstebner
lstebner merged commit 09bb145 into main Jul 10, 2026
2 checks passed
@lstebner
lstebner deleted the fix/sort-dropdown-spacebar-loop-playback branch July 10, 2026 05:17
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.

1 participant