Skip to content

feat(playback): add bounded history and previous controls - #141

Closed
aRustyDev wants to merge 12 commits into
talwat:mainfrom
aRustyDev:stack/2/bounded-playback-history
Closed

aRustyDev wants to merge 12 commits into
talwat:mainfrom
aRustyDev:stack/2/bounded-playback-history

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Oct 30, 2026 •

Copy link
Copy Markdown

TL;DR

Go back to a recently played track without downloading it again. Keep up to 11 tracks in memory for the current session, preserving pause state and the terminal layout.

Important

#blocked-by #139 (which is blocked by #138)

Please wait for #138 and #139 to merge before reviewing this PR. The Files changed tab includes their configuration and testing work because this PR targets main. After they merge, I’ll rebase this branch so the diff contains only bounded history and Previous controls.

History is independent of #140. Incremental history diff for reference.

Changes

Add Previous through configurable bindings.previous (default h), terminal TrackPrevious, and Linux MPRIS. Navigation follows these rules:

Action Result
Previous before 3 seconds Select the retained previous track, if available
Previous at 3 seconds or later Restart the current track
Previous while loading Return to the retained current track
Next after going back Traverse retained forward tracks before downloading again

Keep compressed audio for up to 11 tracks, evicting the oldest when full. Preserve pause state across transitions. Publish MPRIS Previous availability as navigation becomes possible. Windows SMTC Previous remains unavailable; displayed terminal controls stay unchanged.

Document cursor movement, retained forward tracks, restart/loading transitions, and coalesced notifications beside the code. Explain how automatic completion differs from an explicit Next command.

Why this approach

Once Lowfi advances, the previous track is otherwise lost. Retaining compressed tracks makes back/forward navigation immediate without keeping decoded audio or writing a persistent history database.

A fixed track count limits growth, though memory use still depends on track sizes. An unbounded history would keep growing, while re-downloading would add latency and another failure point. Completion and restart-threshold notifications carry a playback generation so an old event cannot advance a replacement track or change its capabilities. Tests exercise the actual waiter notifications as well as player transitions.

Validation

60 default Cargo tests passed on macOS, including eviction, restart thresholds, forward traversal, pause preservation, stale events, loading transitions, and bindings. Formatting, default/no-default Nextest, feature checks, and mutation inventories passed. Native Linux MPRIS suites passed. Private-item documentation passes with broken rustdoc links denied; live D-Bus publication was not exercised.

@aRustyDev aRustyDev changed the title Add bounded playback history Add bounded playback history and Previous controls Oct 30, 2026
@aRustyDev aRustyDev changed the title Add bounded playback history and Previous controls feat(playback): add bounded history and previous controls Oct 30, 2026
@aRustyDev
aRustyDev force-pushed the stack/2/bounded-playback-history branch from 75c7dd3 to 67e234e Compare October 30, 2026 03:33
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