Fix macOS "Where is use_default?" dialog on first desktop notification#20
Merged
dcrjodle merged 1 commit intoJul 14, 2026
Conversation
Ivy-Tendril#1682: the first desktop notification on macOS popped an OS "Where is use_default?" app-picker dialog. rustino_show_notification ignored app_id on macOS and called notify_rust::Notification::show() without ever calling set_application. notify-rust's macOS backend then lazily resolved the bundle id for the literal string "use_default" via AppleScript, and macOS showed a picker dialog for the unrecognized app name. Fix: before the first notification, call notify_rust::set_application exactly once (guarded by a std::sync::Once, since mac-notification-sys latches its own Once even on failure). Try, in order: the app_id FFI param, the running app's own bundle id (NSBundle mainBundle), then "com.apple.Terminal", each pre-validated against LaunchServices via NSWorkspace::URLForApplicationWithBundleIdentifier so we never call set_application with an id it would reject; fall back to "com.apple.Finder" (always installed) if nothing validates. Windows/Linux notification behavior is unchanged.
rorychatt
approved these changes
Jul 14, 2026
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.
Fixes #1682 the bug reported in Ivy-Interactive/Ivy-Tendril#1682: on macOS, the first desktop notification sent by a Rustino app pops the OS "Where is use_default?" application-picker dialog.
Root cause:
rustino_show_notificationnever callednotify_rust::set_applicationon macOS, so mac-notification-sys'sensure_application_set()fell back to resolving the literal app name"use_default"via AppleScript (get id of application "use_default"throughNSAppleScript) — macOS resolves an unknown app name by showing the "Where is…?" picker.Fix: on macOS, before the first notification is shown, call
notify_rust::set_applicationexactly once with a pre-validated bundle id. Candidates in order: theapp_idFFI param →NSBundle.mainBundle.bundleIdentifier→com.apple.Terminal→com.apple.Finder(upstream's own default). Candidates are validated viaNSWorkspace.URLForApplicationWithBundleIdentifier(LaunchServices) before the call, becausemac_notification_sys::set_applicationlatches its internalOnceeven on failure, so it must be called only once and with an id that will be accepted.app_idwas previously ignored on macOS; callers can now pass a real bundle identifier to control which app the notification is attributed to. Display-name values (e.g. "Ivy Tendril") fail LaunchServices validation and safely fall through to the next candidate. Windows (AUMID) and Linux paths are unchanged.Verified:
cargo build,cargo build --release(the command CI runs),cargo clippy --all-targets(no new warnings),cargo test(23 passed) on macOS. The dialog itself can't be reproduced headlessly; the fix rests on the verified call-order in notify-rust 4.14.0 / mac-notification-sys 0.6.12 sources.🤖 Generated with Claude Code