Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"enum": [
"audible",
"window",
"taskbar"
"taskbar",
"notification"
]
}
},
Expand All @@ -70,6 +71,7 @@
"audible",
"taskbar",
"window",
"notification",
Comment on lines 63 to +74
Copy link
Member

Choose a reason for hiding this comment

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

wrong PR

"all",
"none"
]
Expand Down
18 changes: 15 additions & 3 deletions src/cascadia/TerminalApp/DesktopNotification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "pch.h"
#include "DesktopNotification.h"

#include <WtExeUtils.h>

using namespace winrt::Windows::UI::Notifications;
using namespace winrt::Windows::Data::Xml::Dom;

Expand Down Expand Up @@ -88,9 +90,19 @@ namespace winrt::TerminalApp::implementation
}

// For packaged apps, CreateToastNotifier() uses the package identity automatically.
// For unpackaged apps, we need to provide an AUMID, but that case is less common
// and toast notifications may not be supported without additional setup.
auto notifier = ToastNotificationManager::CreateToastNotifier();
// For unpackaged apps, we must pass the explicit AUMID that was registered
// at startup via SetCurrentProcessExplicitAppUserModelID.
auto notifier = IsPackaged() ? ToastNotificationManager::CreateToastNotifier() : ToastNotificationManager::CreateToastNotifier(
#if defined(WT_BRANDING_RELEASE)
L"Microsoft.WindowsTerminal"
#elif defined(WT_BRANDING_PREVIEW)
L"Microsoft.WindowsTerminalPreview"
#elif defined(WT_BRANDING_CANARY)
L"Microsoft.WindowsTerminalCanary"
#else
L"Microsoft.WindowsTerminalDev"
#endif
);
notifier.Show(toast);
}
catch (...)
Expand Down
15 changes: 15 additions & 0 deletions src/cascadia/WindowsTerminal/WindowEmperor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,21 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow)
__assume(false);
}

// When running without package identity, set an explicit AppUserModelID so
// that toast notifications (and other shell features) work correctly.
if (!IsPackaged())
{
#if defined(WT_BRANDING_RELEASE)
LOG_IF_FAILED(SetCurrentProcessExplicitAppUserModelID(L"Microsoft.WindowsTerminal"));
#elif defined(WT_BRANDING_PREVIEW)
LOG_IF_FAILED(SetCurrentProcessExplicitAppUserModelID(L"Microsoft.WindowsTerminalPreview"));
#elif defined(WT_BRANDING_CANARY)
LOG_IF_FAILED(SetCurrentProcessExplicitAppUserModelID(L"Microsoft.WindowsTerminalCanary"));
#else
LOG_IF_FAILED(SetCurrentProcessExplicitAppUserModelID(L"Microsoft.WindowsTerminalDev"));
Comment on lines +389 to +395
Copy link
Member

Choose a reason for hiding this comment

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

how does this work for different versions of portable mode? we have already (and a couple times) fixed issues where portable and unpackaged have "crosstalk". See how we generate the Window ID in the WindowEmperor.

Copy link
Member

Choose a reason for hiding this comment

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

This identifier allows an application to group its associated processes and windows under a single taskbar button.

for example, we do not want different instances of portable mode or unpackaged to glom together with packaged or with eachother.

#endif
}

_app = winrt::TerminalApp::App{};
_app.Logic().ReloadSettings();

Expand Down
Loading