Skip to content

Add custom notification sound support#10

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/plan-requirements-solution
Draft

Add custom notification sound support#10
Copilot wants to merge 5 commits intomainfrom
copilot/plan-requirements-solution

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Adds ability for users to select custom audio files as notification sounds. Currently limited to system sounds only.

Backend

  • Integrated rodio (v0.21.1) for cross-platform audio playback
  • Added play_custom_audio_file() with async execution to prevent UI blocking
  • Modified play_notification_sound() to accept optional path with fallback to system sounds
  • Added test_custom_sound() command for preview functionality

Frontend

  • File picker dialog with filter for common audio formats (MP3, WAV, OGG, FLAC, M4A, AAC, WMA)
  • UI controls: select, change, clear buttons with file path display
  • Test button routes to custom or system sound based on configuration
  • Settings persistence via existing storage mechanism
  • Full i18n support (zh-CN, en-US)

Implementation Notes

Audio stream lifecycle managed via sleep_until_end() to ensure complete playback before resource cleanup. UI toggle uses direct DOM manipulation matching existing pattern from resetOnIdleToggle.

fn play_custom_audio_file(file_path: &str) -> Result<(), String> {
    let (_stream, stream_handle) = OutputStream::try_default()?;
    let sink = Sink::try_new(&stream_handle)?;
    let file = File::open(file_path)?;
    let source = Decoder::new(BufReader::new(file))?;
    sink.append(source);
    sink.sleep_until_end();  // Keeps _stream alive
    Ok(())
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 6, 2026 09:59
Co-authored-by: kaima2022 <112575352+kaima2022@users.noreply.github.com>
Co-authored-by: kaima2022 <112575352+kaima2022@users.noreply.github.com>
Co-authored-by: kaima2022 <112575352+kaima2022@users.noreply.github.com>
Copilot AI changed the title [WIP] Plan requirements for health reminder solution Add custom notification sound support Feb 6, 2026
Copilot AI requested a review from kaima2022 February 6, 2026 10:08
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