Tauri Notifications with Sound

This demo shows how to use sound with Tauri notifications across different platforms.

Make sure you have the notification plugin installed and configured correctly.

Test Notifications

Example Code

// Example with system sound (mainly for macOS)
await sendNotification({
  title: 'Notification with System Sound',
  body: 'This notification uses a system sound on macOS.',
  sound: 'Ping' // macOS system sound
});

// Example with custom sound file
await sendNotification({
  title: 'Notification with Custom Sound',
  body: 'This notification uses a custom sound file.',
  sound: 'notification.wav' // path to your sound file
});

// Example with different sounds based on platform
const platform = await import('@tauri-apps/api/os').then(os => os.platform());
  
let soundPath;
if (platform === 'darwin') {
  soundPath = 'Blow'; // macOS system sound
} else if (platform === 'linux') {
  soundPath = 'message-new-instant'; // XDG theme sound
} else {
  soundPath = 'notification.wav'; // Custom sound file for Windows
}
  
await sendNotification({
  title: 'Platform-specific Sound',
  body: `This notification uses platform-specific sound settings for ${platform}.`,
  sound: soundPath
});