Skip to content

Comments

Add sleep timer to player bar#1671

Merged
jeffvli merged 8 commits intojeffvli:developmentfrom
york9675:development
Feb 11, 2026
Merged

Add sleep timer to player bar#1671
jeffvli merged 8 commits intojeffvli:developmentfrom
york9675:development

Conversation

@york9675
Copy link
Contributor

@york9675 york9675 commented Feb 8, 2026

This pull request introduces a new sleep timer feature for the player, allowing users to set the player to pause playback after a specified time or at the end of the current song. The changes include a new UI button, state management logic, and updated translations to support the feature.

Sleep Timer Feature:

  • Added SleepTimerButton component to the player controls, providing a popover interface for users to set, customize, or cancel a sleep timer. The timer can be set for preset durations, a custom time, or to pause at the end of the current song. (src/renderer/features/player/components/sleep-timer-button.tsx)
  • Introduced sleep-timer.store.ts for managing sleep timer state, including actions for starting, canceling, and updating the timer, as well as selectors for accessing timer status and mode. (src/renderer/store/sleep-timer.store.ts)
  • Integrated the SleepTimerButton into the player’s right controls by updating the imports and component layout. (src/renderer/features/player/components/right-controls.tsx)

UI and Icon Enhancements:

  • Added new icons for the sleep timer feature (sleepTimer, sleepTimerOff) to the app icon set, using LuTimer and LuTimerOff from the icon library. (src/shared/components/icon/icon.tsx)

Resolves #95, resolves #753

image

- Add sleep timer button in player bar right controls
- Preset options: End of song, 5/10/15/30/45 min, 1 hr, 2 hrs
- Custom timer with HH:MM:SS input fields
- Timer only counts down while music is playing
- Timer pauses playback when it expires
- End-of-song mode pauses at the next track change
- Uses theme-aware styling (--theme-colors-surface)
- Add sleepTimer/sleepTimerOff icons (LuTimer/LuTimerOff)
- Add i18n strings for sleep timer UI
Copilot AI review requested due to automatic review settings February 8, 2026 10:38
@vercel
Copy link

vercel bot commented Feb 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
feishin Ready Ready Preview, Comment Feb 11, 2026 5:05am

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “Sleep Timer” feature to the player controls so users can pause playback after a preset/custom duration or after the current song.

Changes:

  • Added a SleepTimerButton popover UI to configure/cancel a sleep timer.
  • Introduced a Zustand store to track sleep timer mode/state/remaining time.
  • Extended the icon set and English translations to support the new UI.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/shared/components/icon/icon.tsx Adds sleepTimer / sleepTimerOff icons to the app icon registry.
src/renderer/store/sleep-timer.store.ts New Zustand store for sleep timer state + selectors/actions.
src/renderer/features/player/components/sleep-timer-button.tsx New UI + timer logic (timed countdown + end-of-song behavior).
src/renderer/features/player/components/right-controls.tsx Integrates the sleep timer button into the player right controls.
src/i18n/locales/en.json Adds new player.sleepTimer* translation keys.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@york9675 york9675 marked this pull request as ready for review February 10, 2026 11:08
@jeffvli
Copy link
Owner

jeffvli commented Feb 11, 2026

Thanks! Overall looks good.

I made a couple changes:

  1. Added a cancel button to allow the user to cancel the Custom timer state without setting a value
  2. Automatically close the Sleep Timer popover after selecting a timer so then it doesn't require a 2 click action
  3. Refactored the sleep timer tick/song change subscribers into a separate hook which is then called in a global context (audio-players.tsx). In some cases, the PlayerBar component can be unrendered (such as resizing to mobile responsive mode) which cuases the listeners to unmount.
  4. Refactored the listeners to use the existing usePlayerEvents hook which already subscribes to the events needed for the feature

@jeffvli jeffvli merged commit cc8cb4f into jeffvli:development Feb 11, 2026
6 checks passed
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.

[Feature request] Stop after current song [Feature request] Sleep Time

2 participants