Skip to content

fix(notifications): activate Win32 toasts through their COM activator - #1792

Merged
eythaann merged 1 commit into
eythaann:masterfrom
z1pp090:fix/toast-com-activator
Sep 8, 2026
Merged

eythaann merged 1 commit into
eythaann:masterfrom
z1pp090:fix/toast-com-activator

Conversation

@z1pp090

@z1pp090 z1pp090 commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1780.

The bug

Clicking a notification that came from a Win32 app with a dedicated toast AUMID fails with:

Windows cannot find shell:AppsFolder\FirefoxToast-308046B0AF4A39CB

It is not specific to Firefox. Enumerating HKCU\SOFTWARE\Classes\AppUserModelId on my machine returns four registrations and three of them declare a CustomActivator: Firefox, FanControl and DSX.

Root cause

Two things chain together, both in src/background/modules/notifications/application.rs.

1. clean_toast synthesizes a launch target that cannot resolve, and forces the wrong activation type.

if toast.launch.is_none() {
    toast.launch = Some(format!("shell:AppsFolder\{umid}"));
    toast.activation_type = ToastActionActivationType::Protocol;
}

The shell:AppsFolder namespace only enumerates packaged apps, so a Win32 toast AUMID is never in it — hence the shell error. And forcing Protocol sends the click down the open_file_inner branch of activate_notification, which means the INotificationActivationCallback path 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_clsid resolves non-packaged AUMIDs by looking them up in the start menu index and reading PKEY_AppUserModel_ToastActivatorCLSID from the shortcut. An AUMID that exists only for toasts has no shortcut carrying it, so the lookup always misses.

The fix

  • Only synthesize the shell:AppsFolder launch for packaged apps. For Win32 apps launch stays empty, so activate_notification falls through to the COM activator that already exists.
  • Read CustomActivator from SOFTWARE\Classes\AppUserModelId\<aumid> (HKCU first, then HKLM, matching how the shell resolves Classes) before falling back to the shortcut lookup.

This is the documented registration point for desktop toasts with a COM server. No new dependencies — winreg was already in use.

Testing

Continuous Integration was run on my fork before opening this: js-test-and-linter, rust-linter and rust-test all 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

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
@eythaann
eythaann merged commit 221c0cd into eythaann:master Sep 8, 2026
4 checks passed
@z1pp090
z1pp090 deleted the fix/toast-com-activator branch September 24, 2026 15:36
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.

[BUG] Clicking a Firefox notification fails with 'Windows cannot find shell:AppsFolder\FirefoxToast-...' (Win32 toast with COM activator)

2 participants