diff --git a/src/cascadia/TerminalApp/Tab.cpp b/src/cascadia/TerminalApp/Tab.cpp index 92cfcf8ed0..df997ad945 100644 --- a/src/cascadia/TerminalApp/Tab.cpp +++ b/src/cascadia/TerminalApp/Tab.cpp @@ -1188,7 +1188,7 @@ namespace winrt::TerminalApp::implementation // Send a desktop toast notification if requested, but only if // the pane isn't already in the belled state. This prevents - // spamming toasts for repeated BEL characters. + // sending repeated toasts for repeated BEL characters. if (bellArgs.SendNotification() && !tab->_tabStatus.BellIndicator()) { tab->TabToastNotificationRequested.raise(tab->Title(), tab->TabViewIndex()); @@ -1209,7 +1209,7 @@ namespace winrt::TerminalApp::implementation events.NotificationRequested = content.NotificationRequested( winrt::auto_revoke, - [dispatcher, weakThis](TerminalApp::IPaneContent sender, auto notifArgs) -> safe_void_coroutine { + [dispatcher, weakThis](TerminalApp::IPaneContent sender, auto notificationArgs) -> safe_void_coroutine { const auto weakThisCopy = weakThis; co_await wil::resume_foreground(dispatcher); if (const auto tab{ weakThisCopy.get() }) @@ -1220,15 +1220,15 @@ namespace winrt::TerminalApp::implementation const auto activeContent = tab->GetActiveContent(); const auto isActivePaneContent = activeContent && activeContent == sender; - if (notifArgs.OnlyWhenInactive() && isActivePaneContent && + if (notificationArgs.OnlyWhenInactive() && isActivePaneContent && tab->_focusState != WUX::FocusState::Unfocused) { co_return; } - const auto style = notifArgs.Style(); + const auto style = notificationArgs.Style(); - if (WI_IsFlagSet(style, winrt::Microsoft::Terminal::Control::OutputNotificationStyle::Taskbar)) + if (WI_IsFlagSet(style, OutputNotificationStyle::Taskbar)) { // Flash the taskbar button tab->TabRaiseVisualBell.raise(); diff --git a/src/cascadia/TerminalApp/TabManagement.cpp b/src/cascadia/TerminalApp/TabManagement.cpp index 6f9a9439dc..aa0a7a3545 100644 --- a/src/cascadia/TerminalApp/TabManagement.cpp +++ b/src/cascadia/TerminalApp/TabManagement.cpp @@ -1205,7 +1205,7 @@ namespace winrt::TerminalApp::implementation void TerminalPage::_SendDesktopNotification(const winrt::hstring& tabTitle, uint32_t tabIndex) { // Build the notification message. - // Use the window name if available for context, otherwise just use the tab title. + // Use the window name if available for context; otherwise just use the tab title. // Use the raw WindowName (not WindowNameForDisplay) so we don't include // the "" placeholder in the notification body. const auto windowName = _WindowProperties ? _WindowProperties.WindowName() : winrt::hstring{}; diff --git a/src/cascadia/TerminalApp/TerminalPaneContent.cpp b/src/cascadia/TerminalApp/TerminalPaneContent.cpp index 6ef42fa634..0b087cdb12 100644 --- a/src/cascadia/TerminalApp/TerminalPaneContent.cpp +++ b/src/cascadia/TerminalApp/TerminalPaneContent.cpp @@ -267,7 +267,7 @@ namespace winrt::TerminalApp::implementation // - // Method Description: // - Plays the notification sound using the profile's BellSound setting if - // configured, otherwise falls back to the system "Critical Stop" sound. + // configured; otherwise falls back to the system "Critical Stop" sound. // Reused by the warning bell handler, NotifyOnNextPrompt, and // NotifyOnInactiveOutput (called from Tab after the active-pane check). void TerminalPaneContent::PlayNotificationSound() diff --git a/src/cascadia/TerminalCore/Terminal.cpp b/src/cascadia/TerminalCore/Terminal.cpp index 3fbf9adc2d..6ca87e4438 100644 --- a/src/cascadia/TerminalCore/Terminal.cpp +++ b/src/cascadia/TerminalCore/Terminal.cpp @@ -750,7 +750,6 @@ TerminalInput::OutputType Terminal::SendCharEvent(const wchar_t ch, const WORD s // This changed the scrollbar marks - raise a notification to update them _NotifyScrollEvent(); - } // regardless, start notify that we started command output if (_pfnOutputStarted) diff --git a/src/cascadia/TerminalSettingsModel/MTSMSettings.h b/src/cascadia/TerminalSettingsModel/MTSMSettings.h index ede64d2fc0..d761177d1c 100644 --- a/src/cascadia/TerminalSettingsModel/MTSMSettings.h +++ b/src/cascadia/TerminalSettingsModel/MTSMSettings.h @@ -79,38 +79,38 @@ Author(s): // * TerminalSettings.cpp: TerminalSettings::_ApplyProfileSettings // * IControlSettings.idl or ICoreSettings.idl // * ControlProperties.h -#define MTSM_PROFILE_SETTINGS(X) \ - X(int32_t, HistorySize, "historySize", DEFAULT_HISTORY_SIZE) \ - X(bool, SnapOnInput, "snapOnInput", true) \ - X(bool, AltGrAliasing, "altGrAliasing", true) \ - X(hstring, AnswerbackMessage, "answerbackMessage") \ - X(hstring, Commandline, "commandline", L"%SystemRoot%\\System32\\cmd.exe") \ - X(Microsoft::Terminal::Control::ScrollbarState, ScrollState, "scrollbarState", Microsoft::Terminal::Control::ScrollbarState::Visible) \ - X(Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode, "antialiasingMode", Microsoft::Terminal::Control::TextAntialiasingMode::Grayscale) \ - X(hstring, StartingDirectory, "startingDirectory") \ - X(IMediaResource, Icon, "icon", implementation::MediaResource::FromString(L"\uE756")) \ - X(bool, SuppressApplicationTitle, "suppressApplicationTitle", false) \ - X(guid, ConnectionType, "connectionType") \ - X(CloseOnExitMode, CloseOnExit, "closeOnExit", CloseOnExitMode::Automatic) \ - X(hstring, TabTitle, "tabTitle") \ - X(Model::BellStyle, BellStyle, "bellStyle", BellStyle::Audible) \ - X(IEnvironmentVariableMap, EnvironmentVariables, "environment", nullptr) \ - X(bool, RightClickContextMenu, "rightClickContextMenu", false) \ - X(Windows::Foundation::Collections::IVector, BellSound, "bellSound", nullptr) \ - X(bool, Elevate, "elevate", false) \ - X(bool, AutoMarkPrompts, "autoMarkPrompts", true) \ - X(bool, ShowMarks, "showMarksOnScrollbar", false) \ - X(bool, RepositionCursorWithMouse, "experimental.repositionCursorWithMouse", false) \ - X(bool, ReloadEnvironmentVariables, "compatibility.reloadEnvironmentVariables", true) \ - X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \ - X(bool, ForceVTInput, "compatibility.input.forceVT", false) \ - X(bool, AllowKittyKeyboardMode, "compatibility.kittyKeyboardMode", true) \ - X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \ - X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \ - X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \ - X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None) \ - X(Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnInactiveOutput, "notifyOnInactiveOutput", Microsoft::Terminal::Control::OutputNotificationStyle{0}) \ - X(Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnNextPrompt, "notifyOnNextPrompt", Microsoft::Terminal::Control::OutputNotificationStyle{0}) \ +#define MTSM_PROFILE_SETTINGS(X) \ + X(int32_t, HistorySize, "historySize", DEFAULT_HISTORY_SIZE) \ + X(bool, SnapOnInput, "snapOnInput", true) \ + X(bool, AltGrAliasing, "altGrAliasing", true) \ + X(hstring, AnswerbackMessage, "answerbackMessage") \ + X(hstring, Commandline, "commandline", L"%SystemRoot%\\System32\\cmd.exe") \ + X(Microsoft::Terminal::Control::ScrollbarState, ScrollState, "scrollbarState", Microsoft::Terminal::Control::ScrollbarState::Visible) \ + X(Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode, "antialiasingMode", Microsoft::Terminal::Control::TextAntialiasingMode::Grayscale) \ + X(hstring, StartingDirectory, "startingDirectory") \ + X(IMediaResource, Icon, "icon", implementation::MediaResource::FromString(L"\uE756")) \ + X(bool, SuppressApplicationTitle, "suppressApplicationTitle", false) \ + X(guid, ConnectionType, "connectionType") \ + X(CloseOnExitMode, CloseOnExit, "closeOnExit", CloseOnExitMode::Automatic) \ + X(hstring, TabTitle, "tabTitle") \ + X(Model::BellStyle, BellStyle, "bellStyle", BellStyle::Audible) \ + X(IEnvironmentVariableMap, EnvironmentVariables, "environment", nullptr) \ + X(bool, RightClickContextMenu, "rightClickContextMenu", false) \ + X(Windows::Foundation::Collections::IVector, BellSound, "bellSound", nullptr) \ + X(bool, Elevate, "elevate", false) \ + X(bool, AutoMarkPrompts, "autoMarkPrompts", true) \ + X(bool, ShowMarks, "showMarksOnScrollbar", false) \ + X(bool, RepositionCursorWithMouse, "experimental.repositionCursorWithMouse", false) \ + X(bool, ReloadEnvironmentVariables, "compatibility.reloadEnvironmentVariables", true) \ + X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \ + X(bool, ForceVTInput, "compatibility.input.forceVT", false) \ + X(bool, AllowKittyKeyboardMode, "compatibility.kittyKeyboardMode", true) \ + X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \ + X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \ + X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \ + X(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, "pathTranslationStyle", Microsoft::Terminal::Control::PathTranslationStyle::None) \ + X(Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnInactiveOutput, "notifyOnInactiveOutput", Microsoft::Terminal::Control::OutputNotificationStyle{ 0 }) \ + X(Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnNextPrompt, "notifyOnNextPrompt", Microsoft::Terminal::Control::OutputNotificationStyle{ 0 }) \ X(Microsoft::Terminal::Control::AutoDetectRunningCommand, AutoDetectRunningCommand, "autoDetectRunningCommand", Microsoft::Terminal::Control::AutoDetectRunningCommand::Disabled) // Intentionally omitted Profile settings: diff --git a/src/cascadia/WindowsTerminal/WindowEmperor.cpp b/src/cascadia/WindowsTerminal/WindowEmperor.cpp index 4b83dd2c9f..7f59cbee2d 100644 --- a/src/cascadia/WindowsTerminal/WindowEmperor.cpp +++ b/src/cascadia/WindowsTerminal/WindowEmperor.cpp @@ -354,15 +354,13 @@ void WindowEmperor::HandleCommandlineArgs(int nCmdShow) } // Toast notification activations launch a new unelevated instance of the - // app with "__fromToast" as the sole command-line argument. This happens - // when the originating Terminal window is elevated — Windows cannot - // COM-activate an elevated process from a toast click, so it starts a new - // unelevated process instead. That process must not restore persisted - // layouts, create windows, or do anything else — just exit immediately. + // app with "__fromToast" as the sole command-line argument. It will always + // start a new instance of our exe. // - // We check this BEFORE the mutex handoff because the elevated instance - // owns the mutex and UIPI blocks WM_COPYDATA from our unelevated process, - // which would cause acquireMutexOrAttemptHandoff to spin for ~30s. + // However, we're also able to just handle the .Activated event on the toast + // itself, so we don't care about this process we're spawning. So before we + // do _anything_ else, if we were created for a toast, just immediately + // bail. const auto args = commandlineToArgArray(GetCommandLineW()); { if (args.size() == 2 && args[1] == L"__fromToast") diff --git a/src/cascadia/inc/ControlProperties.h b/src/cascadia/inc/ControlProperties.h index 1f2e96fed4..9ed02f4e09 100644 --- a/src/cascadia/inc/ControlProperties.h +++ b/src/cascadia/inc/ControlProperties.h @@ -60,34 +60,34 @@ // --------------------------- Control Settings --------------------------- // All of these settings are defined in IControlSettings. -#define CONTROL_SETTINGS(X) \ - X(winrt::guid, SessionId) \ - X(bool, EnableUnfocusedAcrylic, false) \ - X(winrt::hstring, Padding, DEFAULT_PADDING) \ - X(winrt::hstring, FontFace, L"Consolas") \ - X(float, FontSize, DEFAULT_FONT_SIZE) \ - X(winrt::Windows::UI::Text::FontWeight, FontWeight) \ - X(IFontFeatureMap, FontFeatures) \ - X(IFontAxesMap, FontAxes) \ - X(bool, EnableBuiltinGlyphs, true) \ - X(bool, EnableColorGlyphs, true) \ - X(winrt::hstring, CellWidth) \ - X(winrt::hstring, CellHeight) \ - X(winrt::hstring, Commandline) \ - X(winrt::hstring, StartingDirectory) \ - X(winrt::Microsoft::Terminal::Control::ScrollbarState, ScrollState, winrt::Microsoft::Terminal::Control::ScrollbarState::Visible) \ - X(winrt::Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode, winrt::Microsoft::Terminal::Control::TextAntialiasingMode::Grayscale) \ - X(winrt::Microsoft::Terminal::Control::GraphicsAPI, GraphicsAPI) \ - X(bool, DisablePartialInvalidation, false) \ - X(bool, SoftwareRendering, false) \ - X(winrt::Microsoft::Terminal::Control::TextMeasurement, TextMeasurement) \ - X(winrt::Microsoft::Terminal::Control::AmbiguousWidth, AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth::Narrow) \ - X(winrt::Microsoft::Terminal::Control::DefaultInputScope, DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope::Default) \ - X(bool, UseBackgroundImageForWindow, false) \ - X(bool, ShowMarks, false) \ - X(winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0) \ - X(bool, RightClickContextMenu, false) \ - X(winrt::Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, winrt::Microsoft::Terminal::Control::PathTranslationStyle::None) \ - X(winrt::Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnInactiveOutput, winrt::Microsoft::Terminal::Control::OutputNotificationStyle{0}) \ - X(winrt::Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnNextPrompt, winrt::Microsoft::Terminal::Control::OutputNotificationStyle{0}) \ +#define CONTROL_SETTINGS(X) \ + X(winrt::guid, SessionId) \ + X(bool, EnableUnfocusedAcrylic, false) \ + X(winrt::hstring, Padding, DEFAULT_PADDING) \ + X(winrt::hstring, FontFace, L"Consolas") \ + X(float, FontSize, DEFAULT_FONT_SIZE) \ + X(winrt::Windows::UI::Text::FontWeight, FontWeight) \ + X(IFontFeatureMap, FontFeatures) \ + X(IFontAxesMap, FontAxes) \ + X(bool, EnableBuiltinGlyphs, true) \ + X(bool, EnableColorGlyphs, true) \ + X(winrt::hstring, CellWidth) \ + X(winrt::hstring, CellHeight) \ + X(winrt::hstring, Commandline) \ + X(winrt::hstring, StartingDirectory) \ + X(winrt::Microsoft::Terminal::Control::ScrollbarState, ScrollState, winrt::Microsoft::Terminal::Control::ScrollbarState::Visible) \ + X(winrt::Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode, winrt::Microsoft::Terminal::Control::TextAntialiasingMode::Grayscale) \ + X(winrt::Microsoft::Terminal::Control::GraphicsAPI, GraphicsAPI) \ + X(bool, DisablePartialInvalidation, false) \ + X(bool, SoftwareRendering, false) \ + X(winrt::Microsoft::Terminal::Control::TextMeasurement, TextMeasurement) \ + X(winrt::Microsoft::Terminal::Control::AmbiguousWidth, AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth::Narrow) \ + X(winrt::Microsoft::Terminal::Control::DefaultInputScope, DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope::Default) \ + X(bool, UseBackgroundImageForWindow, false) \ + X(bool, ShowMarks, false) \ + X(winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0) \ + X(bool, RightClickContextMenu, false) \ + X(winrt::Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle, winrt::Microsoft::Terminal::Control::PathTranslationStyle::None) \ + X(winrt::Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnInactiveOutput, winrt::Microsoft::Terminal::Control::OutputNotificationStyle{ 0 }) \ + X(winrt::Microsoft::Terminal::Control::OutputNotificationStyle, NotifyOnNextPrompt, winrt::Microsoft::Terminal::Control::OutputNotificationStyle{ 0 }) \ X(winrt::Microsoft::Terminal::Control::AutoDetectRunningCommand, AutoDetectRunningCommand, winrt::Microsoft::Terminal::Control::AutoDetectRunningCommand::Disabled) diff --git a/tools/OpenConsole.psm1 b/tools/OpenConsole.psm1 index b9c80ce457..12078e862a 100644 --- a/tools/OpenConsole.psm1 +++ b/tools/OpenConsole.psm1 @@ -417,8 +417,15 @@ function Invoke-CodeFormat() { ) $clangFormatPath = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -find "**\x64\bin\clang-format.exe" + If ([String]::IsNullOrEmpty($clangFormatPath)) { + # try again with prerelease versions of Visual Studio, + # and just take the first + $clangFormatPath = & 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -prerelease -find "**\clang-format.exe" | Select-Object -First 1 + } + If ([String]::IsNullOrEmpty($clangFormatPath)) { Write-Error "No Visual Studio-supplied version of clang-format could be found." + return -1 } $root = Find-OpenConsoleRoot diff --git a/tools/runformat.cmd b/tools/runformat.cmd index d9c1d56c73..9c83fdd004 100644 --- a/tools/runformat.cmd +++ b/tools/runformat.cmd @@ -2,4 +2,4 @@ rem run clang-format on c++ files -powershell -noprofile "import-module %OPENCON_TOOLS%\openconsole.psm1; Invoke-CodeFormat" +pwsh -noprofile "import-module %OPENCON_TOOLS%\openconsole.psm1; Invoke-CodeFormat"