Enum tauri::api::notification::Sound
source · pub enum Sound {
Default,
Custom(String),
}
desktop
and crate feature notification
only.Expand description
Notification sound.
Variants§
Default
The default notification sound.
Custom(String)
A custom notification sound.
§Platform-specific
Each OS has a different sound name so you will need to conditionally specify an appropriate sound based on the OS in use, for a list of sounds see:
-
Linux: can be one of the sounds listed in https://0pointer.de/public/sound-naming-spec.html
-
Windows: can be one of the sounds listed in https://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-audio but without the prefix, for example, if
ms-winsoundevent:Notification.Default
you would useDefault
and ifms-winsoundevent:Notification.Looping.Alarm2
, you would useAlarm2
. Windows 7 is not supported, if a sound is provided, it will play the default sound, otherwise it will be silent. -
macOS: you can specify the name of the sound you’d like to play when the notification is shown. Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. Be sure that the sound file is under one of the following locations:
~/Library/Sounds
/Library/Sounds
/Network/Library/Sounds
/System/Library/Sounds
See the
NSSound
docs for more information.