Skip to content

Add config option for playing sound-hints with desktop notifications - #481

Merged
ulyssa merged 4 commits into
ulyssa:mainfrom
Akselmo:add-desktop-notif-sound-hint
Aug 22, 2025
Merged

ulyssa merged 4 commits into
ulyssa:mainfrom
Akselmo:add-desktop-notif-sound-hint

Conversation

@Akselmo

@Akselmo Akselmo commented Jul 31, 2025

Copy link
Copy Markdown
Contributor

This patch adds a configuration element called play_sound (bool, false by default) that when set true,
it will tell the notification to use sound hint called message-new-instant which then plays a sound,
depending on the platform the app is running in.

(I haven't really used Rust before so bear with me 😅 )

This patch adds a configuration element called "play_sound (bool, false
by default)" that when set true, it will tell the notification to use
sound hint called
"message-new-instant" which then plays a sound, depending on the
platform the app is running in.
@Akselmo

Akselmo commented Jul 31, 2025

Copy link
Copy Markdown
Contributor Author

I haven't added docs yet, just testing the waters first.

@VAWVAW

VAWVAW commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator

I think it would make more sense to make the config option a string with the sound name. Some people might want a different sound to play and I'm not certain the default sounds on windows and macos use the same name as linux anyways. We could then list the default sound names for each OS in the documentation.

@Akselmo

Akselmo commented Jul 31, 2025

Copy link
Copy Markdown
Contributor Author

I think it would make more sense to make the config option a string with the sound name. Some people might want a different sound to play and I'm not certain the default sounds on windows and macos use the same name as linux anyways. We could then list the default sound names for each OS in the documentation.

Yeah i can do that instead.

@Akselmo

Akselmo commented Aug 2, 2025

Copy link
Copy Markdown
Contributor Author

Turned it into a String. I don't know if theres some better way to do that though, I have not written much rust.

@VAWVAW VAWVAW left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Just some small suggestions according coding style.

Comment thread src/config.rs Outdated
Comment thread src/notifications.rs Outdated
Comment thread src/notifications.rs Outdated
Comment thread src/notifications.rs Outdated
Comment thread src/notifications.rs Outdated
Comment thread src/notifications.rs Outdated
Comment thread src/tests.rs Outdated
@Akselmo

Akselmo commented Aug 2, 2025

Copy link
Copy Markdown
Contributor Author

Will write documentation about it next.

@ulyssa ulyssa changed the title Add configuration for playing sound-hints with desktop notifications Add config option for playing sound-hints with desktop notifications Aug 22, 2025
@ulyssa
ulyssa merged commit 6ebb7ac into ulyssa:main Aug 22, 2025
3 checks passed
@ulyssa

ulyssa commented Aug 22, 2025

Copy link
Copy Markdown
Owner

This looks good! Thank you @Akselmo for adding this! I'll make sure it gets added to the website when I cut the release.

@VAWVAW

VAWVAW commented Aug 22, 2025

Copy link
Copy Markdown
Collaborator

@ulyssa will you also add it to the man page or should that be a new PR?

@Akselmo

Akselmo commented Aug 23, 2025

Copy link
Copy Markdown
Contributor Author

I'm jotting this down here before I forget as some basic outline for the manual entry:

  • Setting uses XDG sound hint names as mentioned in the spec
  • Good example value is message-new-instant
  • Leaving it empty disables sound

@VAWVAW

VAWVAW commented Aug 23, 2025

Copy link
Copy Markdown
Collaborator

For windows the options are "Default", "IM", "Mail", "Reminder", "SMS" (https://docs.rs/tauri-winrt-notification/0.7.2/src/tauri_winrt_notification/lib.rs.html#118-131) and "Alarm", "Alarm2", ..., "Alarm10", "Call", "Call2", ..., "Call10" (https://docs.rs/tauri-winrt-notification/0.7.2/src/tauri_winrt_notification/lib.rs.html#198-226).

@VAWVAW

VAWVAW commented Aug 23, 2025

Copy link
Copy Markdown
Collaborator

For macos, it seems like the system sounds are located in /System/Library/Sounds (https://developer.apple.com/documentation/usernotifications/unnotificationsound)

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.

3 participants