feat: pause playback on app quit#967
Open
mvanhorn wants to merge 1 commit intoaome510:masterfrom
Open
Conversation
Send a Pause request before setting is_running to false so playback stops when the user quits. The PlayerRequest::Pause handler already guards on is_playing, so this is a no-op when nothing is playing. Fixes aome510#944
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sends a Pause request when the user quits the TUI so playback stops instead of continuing in the background.
Why this matters
If a song is playing and you close the app, it keeps playing through Spotify's servers. Reopening the app later doesn't resume where you left off. Pausing on quit fixes both problems.
Changes
spotify_player/src/event/mod.rs: AddPlayerRequest::Pausesend in theCommand::Quithandler, before settingis_running = false.The
PlayerRequest::Pausehandler (inclient/mod.rs:296) already checksplayback.is_playing, so this is a no-op when nothing is playing. The flume channelsend()queues the message synchronously, and the client consumer processes it during the UI loop's refresh sleep beforeprocess::exitruns.Testing
Verified the change compiles and follows the same pattern as other player commands (NextTrack, PreviousTrack, ResumePause) which all use
client_pub.send(ClientRequest::Player(...)).Fixes #944
This contribution was developed with AI assistance (Claude Code).