Repository navigation
Windows: a notification sound file of the user's own - #150
Open
JosueMeserom wants to merge 1 commit into
Open
JosueMeserom wants to merge 1 commit into
JosueMeserom wants to merge 1 commit into
Conversation
Settings > Notifications gets "Alert sound" (Windows only): a WAV, MP3, M4A, WMA, FLAC or OGG file played instead of Windows' toast sound. An unpackaged app's toast can only name Windows' own sounds, so with a file chosen the toast goes silent and whatRust plays the file with MediaPlayer, in its own audio session and without an entry in Windows' media controls. A new sound cuts off the one still playing. A file that has gone away falls back to Windows' sound; a backup keeps this computer's file, as it does the download folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Settings › Notifications gets an Alert sound row (Windows only): pick a WAV, MP3, M4A/AAC, WMA, FLAC or OGG file and whatRust plays it for message notifications instead of Windows' toast sound. Reset to default goes back to Windows' sound. Nothing changes until a file is chosen.
Why
An app without package identity can only name one of Windows' own
ms-winsoundevent:sounds in its toast XML, not a file, so there was no way to get, for example, the sound of the official WhatsApp app.How
sound.rsplays the file with WinRT'sMediaPlayer, on a thread of its own, in whatRust's own audio session (so the volume mixer controls it with the app). Its command manager is disabled, so it adds no entry to Windows' media controls.set_settingsonly accept existing files with one of the extensions above.pick_notification_sound: listed inbuild.rs, granted incapabilities/settings.json(Settings window only, notmain-remote) and added toipc_acl_tests.rs. It plays the chosen file once so it can be heard.i18n.rsandsettings-ui/i18n.js(English, Spanish, Arabic, Indonesian).windowscrate are added (Media_Core,Media_Playback); no new crates, soflatpak/cargo-sources.jsondoes not change.sound::usableandsound::custom.Testing
cargo build --releaseand in daily use with the notification sound of WhatsApp's Store app (an.m4a). The toast is silent, the file plays, and the picker works.cargo fmt --check,cargo clippy --locked -- -D warningsandcargo test --lockedpass on Windows; the JavaScript tests from CONTRIBUTING.md pass.sound::playis a no-op;sound::customand its test are behind#[cfg(windows)]so clippy has no dead code there, but I could not run clippy on those systems.🤖 Generated with Claude Code