Repository navigation
fix(notifications): activate Win32 toasts through their COM activator - #1792
Merged
Merged
Conversation
Win32 apps that use a dedicated toast AUMID (Firefox's `FirefoxToast-*`, FanControl, DSX...) register it under `SOFTWARE\Classes\AppUserModelId` with a `CustomActivator` value. Two things kept those toasts from ever reaching that activator: - `clean_toast` synthesized `shell:AppsFolder\<aumid>` as the launch target for any toast without an explicit one, and forced `Protocol` activation. That namespace only lists packaged apps, so clicking the notification failed with "Windows cannot find shell:AppsFolder\<aumid>", and the forced `Protocol` type meant the COM activator path was skipped entirely. - `get_toast_activator_clsid` resolved non-packaged AUMIDs by looking them up in the start menu index and reading `PKEY_AppUserModel_ToastActivatorCLSID` from the shortcut. A dedicated toast AUMID has no shortcut carrying it, so the lookup always missed. Only synthesize the `shell:AppsFolder` launch for packaged apps, and read `CustomActivator` from the registry (HKCU first, then HKLM) before falling back to the shortcut lookup. Closes eythaann#1780 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StkifHpSLWH4J5TvuP56ur
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.
Closes #1780.
The bug
Clicking a notification that came from a Win32 app with a dedicated toast AUMID fails with:
It is not specific to Firefox. Enumerating
HKCU\SOFTWARE\Classes\AppUserModelIdon my machine returns four registrations and three of them declare aCustomActivator: Firefox, FanControl and DSX.Root cause
Two things chain together, both in
src/background/modules/notifications/application.rs.1.
clean_toastsynthesizes a launch target that cannot resolve, and forces the wrong activation type.The
shell:AppsFoldernamespace only enumerates packaged apps, so a Win32 toast AUMID is never in it — hence the shell error. And forcingProtocolsends the click down theopen_file_innerbranch ofactivate_notification, which means theINotificationActivationCallbackpath is skipped entirely, even though that is the correct way to activate these toasts.2. Even when reached, the CLSID lookup cannot find them.
get_toast_activator_clsidresolves non-packaged AUMIDs by looking them up in the start menu index and readingPKEY_AppUserModel_ToastActivatorCLSIDfrom the shortcut. An AUMID that exists only for toasts has no shortcut carrying it, so the lookup always misses.The fix
shell:AppsFolderlaunch for packaged apps. For Win32 appslaunchstays empty, soactivate_notificationfalls through to the COM activator that already exists.CustomActivatorfromSOFTWARE\Classes\AppUserModelId\<aumid>(HKCU first, then HKLM, matching how the shell resolvesClasses) before falling back to the shortcut lookup.This is the documented registration point for desktop toasts with a COM server. No new dependencies —
winregwas already in use.Testing
Continuous Integration was run on my fork before opening this:
js-test-and-linter,rust-linterandrust-testall pass.Not yet verified at runtime. I do not have a local build environment for this project, so the change has not been exercised against a real toast on my machine. The reasoning is derived from the registry evidence in #1780 and from reading the activation path. Runtime confirmation from someone who can build it, or from a nightly, would be welcome before merging.
🤖 Generated with Claude Code