Skip to content

Conversation

@Cleboost
Copy link
Contributor

@Cleboost Cleboost commented Jun 30, 2025

Introduces a TaskbarManager for Windows that adds playback control buttons (play/pause, next, previous) to the taskbar thumbnail toolbar. Updates playback controller to initialize and update these buttons based on playback state, and adds a new PLAY_PAUSE_OR_RESUME command for unified play/pause handling. Updates dependencies to include the windows crate and related packages.

close #659

{E539EC52-B697-4595-B983-B2877D835BBE}
{13E43559-D2AA-402B-B642-4427473296A0}

Introduces a TaskbarManager for Windows that adds playback control buttons (play/pause, next, previous) to the taskbar thumbnail toolbar. Updates playback controller to initialize and update these buttons based on playback state, and adds a new PLAY_PAUSE_OR_RESUME command for unified play/pause handling. Updates dependencies to include the windows crate and related packages.
Copy link
Collaborator

@jacksongoode jacksongoode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I haven't gone through it extensively, but I am curious about how the taskbar manager needs to be initialized on the first play. Is this a necessity or could we initialize it without first playing any media?

I'll review again when there's a little more time.


if let Some(queued) = data.queued_entry(*item) {
data.start_playback(queued.item, queued.origin, progress.to_owned());
self.setup_taskbar_buttons_on_first_play(PlaybackState::Playing);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this here and below on line 536? This section is for the queued media?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only display the buttons once the first track has started playing. This prevents having controls that don't do anything. It also ensures that the window is fully loaded before injecting the buttons.

I'm not sure it's the right place to call the function, but it worked, so I didn't think too much about it.

@Cleboost
Copy link
Contributor Author

This looks good. I haven't gone through it extensively, but I am curious about how the taskbar manager needs to be initialized on the first play. Is this a necessity or could we initialize it without first playing any media?

I'll review again when there's a little more time.

Technically, we could initialize the buttons before the first track starts playing, but that would mean handling controls that are essentially useless until something is playing, plus adding an extra check to ensure the Windows window is properly loaded before interacting with it.
The current system avoids all that, since launching a track guarantees that the window is ready. Error handling is already implemented on the taskbar side anyway, so there should be no real risk.

@Nrwh1
Copy link

Nrwh1 commented Jul 3, 2025

For the record, this is what the controls look like on Spotify when there's no song playing. (Clicking the play/pause button swaps the display button between play and pause but doesn't do anything playback wise)
image

@Cleboost
Copy link
Contributor Author

Cleboost commented Jul 3, 2025

Okay! I didn't know that you could disable a button, I'll probably do that at launch when no music is playing.

Adds a dedicated INITIALIZE_TASKBAR command and defers taskbar button setup until after widget initialization. Refactors taskbar button update logic to update all buttons and enable/disable them based on playback state, improving reliability and consistency of taskbar controls.
@Cleboost Cleboost requested a review from jacksongoode July 7, 2025 12:36
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.

Windows Taskbar Playback Controls

3 participants