-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Set AppUserModelID for unpackaged #20018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,6 +364,29 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow) | |
| __assume(false); | ||
| } | ||
|
|
||
| // When running without package identity, set an explicit AppUserModelID so | ||
| // that toast notifications (and other shell features like taskbar grouping) | ||
| // work correctly. We include a hash of the executable path to prevent | ||
| // crosstalk between different portable/unpackaged installations — the same | ||
| // isolation strategy used for the single-instance mutex above. | ||
| if (!IsPackaged()) | ||
| { | ||
| std::wstring aumid; | ||
| #if defined(WT_BRANDING_RELEASE) | ||
| aumid = L"Microsoft.WindowsTerminal"; | ||
| #elif defined(WT_BRANDING_PREVIEW) | ||
| aumid = L"Microsoft.WindowsTerminalPreview"; | ||
| #elif defined(WT_BRANDING_CANARY) | ||
| aumid = L"Microsoft.WindowsTerminalCanary"; | ||
| #else | ||
| aumid = L"Microsoft.WindowsTerminalDev"; | ||
| #endif | ||
| const auto path = wil::QueryFullProcessImageNameW<std::wstring>(); | ||
| const auto hash = til::hash(path); | ||
| fmt::format_to(std::back_inserter(aumid), FMT_COMPILE(L".{:016x}"), hash); | ||
|
||
| LOG_IF_FAILED(SetCurrentProcessExplicitAppUserModelID(aumid.c_str())); | ||
| } | ||
|
|
||
| _app = winrt::TerminalApp::App{}; | ||
| _app.Logic().ReloadSettings(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.