Replace TrayIcon with NotificationIcon (#11219)
This PR simply replaces all uses of "TrayIcon" and "Tray" with "NotificationIcon" and "NotificationArea" to be more accurate. Originally I kinda wanted to only replace all occurrences of it in settings and user facing things, but I figured I might as well make it consistent throughout all of our code.
This commit is contained in:
parent
b4a40ff11e
commit
844d46a132
|
@ -1262,14 +1262,14 @@
|
|||
"type": [ "integer", "string" ],
|
||||
"deprecated": true
|
||||
},
|
||||
"minimizeToTray": {
|
||||
"minimizeToNotificationArea": {
|
||||
"default": "false",
|
||||
"description": "When set to true, minimizing a Terminal window will no longer appear in the taskbar. Instead, a Terminal icon will appear in the system tray through which the user can access their windows.",
|
||||
"description": "When set to true, minimizing a Terminal window will no longer appear in the taskbar. Instead, a Terminal icon will appear in the notification area through which the user can access their windows.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"alwaysShowTrayIcon": {
|
||||
"alwaysShowNotificationIcon": {
|
||||
"default": "false",
|
||||
"description": "When set to true, the Terminal's tray icon will always be shown in the system tray.",
|
||||
"description": "When set to true, the Terminal's notification icon will always be shown in the notification area.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"useAcrylicInTabRow": {
|
||||
|
|
|
@ -80,8 +80,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
peasant.IdentifyWindowsRequested({ this, &Monarch::_identifyWindows });
|
||||
peasant.RenameRequested({ this, &Monarch::_renameRequested });
|
||||
|
||||
peasant.ShowTrayIconRequested([this](auto&&, auto&&) { _ShowTrayIconRequestedHandlers(*this, nullptr); });
|
||||
peasant.HideTrayIconRequested([this](auto&&, auto&&) { _HideTrayIconRequestedHandlers(*this, nullptr); });
|
||||
peasant.ShowNotificationIconRequested([this](auto&&, auto&&) { _ShowNotificationIconRequestedHandlers(*this, nullptr); });
|
||||
peasant.HideNotificationIconRequested([this](auto&&, auto&&) { _HideNotificationIconRequestedHandlers(*this, nullptr); });
|
||||
peasant.QuitAllRequested({ this, &Monarch::_handleQuitAll });
|
||||
|
||||
_peasants[newPeasantsId] = peasant;
|
||||
|
|
|
@ -60,8 +60,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
|
||||
|
||||
TYPED_EVENT(FindTargetWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::FindTargetWindowArgs);
|
||||
TYPED_EVENT(ShowTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowCreated, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowClosed, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
|
|
|
@ -54,8 +54,8 @@ namespace Microsoft.Terminal.Remoting
|
|||
Windows.Foundation.Collections.IVectorView<PeasantInfo> GetPeasantInfos { get; };
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<Object, FindTargetWindowArgs> FindTargetWindowRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> ShowTrayIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> HideTrayIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> ShowNotificationIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> HideNotificationIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> WindowCreated;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> WindowClosed;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> QuitAllRequested;
|
||||
|
|
|
@ -226,34 +226,34 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||
}
|
||||
|
||||
void Peasant::RequestShowTrayIcon()
|
||||
void Peasant::RequestShowNotificationIcon()
|
||||
{
|
||||
try
|
||||
{
|
||||
_ShowTrayIconRequestedHandlers(*this, nullptr);
|
||||
_ShowNotificationIconRequestedHandlers(*this, nullptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_CAUGHT_EXCEPTION();
|
||||
}
|
||||
TraceLoggingWrite(g_hRemotingProvider,
|
||||
"Peasant_RequestShowTrayIcon",
|
||||
"Peasant_RequestShowNotificationIcon",
|
||||
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||
}
|
||||
|
||||
void Peasant::RequestHideTrayIcon()
|
||||
void Peasant::RequestHideNotificationIcon()
|
||||
{
|
||||
try
|
||||
{
|
||||
_HideTrayIconRequestedHandlers(*this, nullptr);
|
||||
_HideNotificationIconRequestedHandlers(*this, nullptr);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_CAUGHT_EXCEPTION();
|
||||
}
|
||||
TraceLoggingWrite(g_hRemotingProvider,
|
||||
"Peasant_RequestHideTrayIcon",
|
||||
"Peasant_RequestHideNotificationIcon",
|
||||
TraceLoggingLevel(WINEVENT_LEVEL_VERBOSE),
|
||||
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
void RequestIdentifyWindows();
|
||||
void DisplayWindowId();
|
||||
void RequestRename(const winrt::Microsoft::Terminal::Remoting::RenameRequestArgs& args);
|
||||
void RequestShowTrayIcon();
|
||||
void RequestHideTrayIcon();
|
||||
void RequestShowNotificationIcon();
|
||||
void RequestHideNotificationIcon();
|
||||
void RequestQuitAll();
|
||||
void Quit();
|
||||
|
||||
|
@ -45,8 +45,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
TYPED_EVENT(DisplayWindowIdRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(RenameRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::RenameRequestArgs);
|
||||
TYPED_EVENT(SummonRequested, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Remoting::SummonWindowBehavior);
|
||||
TYPED_EVENT(ShowTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ namespace Microsoft.Terminal.Remoting
|
|||
void RequestIdentifyWindows(); // Tells us to raise a IdentifyWindowsRequested
|
||||
void RequestRename(RenameRequestArgs args); // Tells us to raise a RenameRequested
|
||||
void Summon(SummonWindowBehavior behavior);
|
||||
void RequestShowTrayIcon();
|
||||
void RequestHideTrayIcon();
|
||||
void RequestShowNotificationIcon();
|
||||
void RequestHideNotificationIcon();
|
||||
void RequestQuitAll();
|
||||
void Quit();
|
||||
|
||||
|
@ -76,8 +76,8 @@ namespace Microsoft.Terminal.Remoting
|
|||
event Windows.Foundation.TypedEventHandler<Object, Object> DisplayWindowIdRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, RenameRequestArgs> RenameRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, SummonWindowBehavior> SummonRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> ShowTrayIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> HideTrayIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> ShowNotificationIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> HideNotificationIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> QuitAllRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> QuitRequested;
|
||||
};
|
||||
|
|
|
@ -269,8 +269,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
_monarch.WindowCreated({ get_weak(), &WindowManager::_WindowCreatedHandlers });
|
||||
_monarch.WindowClosed({ get_weak(), &WindowManager::_WindowClosedHandlers });
|
||||
_monarch.FindTargetWindowRequested({ this, &WindowManager::_raiseFindTargetWindowRequested });
|
||||
_monarch.ShowTrayIconRequested([this](auto&&, auto&&) { _ShowTrayIconRequestedHandlers(*this, nullptr); });
|
||||
_monarch.HideTrayIconRequested([this](auto&&, auto&&) { _HideTrayIconRequestedHandlers(*this, nullptr); });
|
||||
_monarch.ShowNotificationIconRequested([this](auto&&, auto&&) { _ShowNotificationIconRequestedHandlers(*this, nullptr); });
|
||||
_monarch.HideNotificationIconRequested([this](auto&&, auto&&) { _HideNotificationIconRequestedHandlers(*this, nullptr); });
|
||||
_monarch.QuitAllRequested([this](auto&&, auto&&) { _QuitAllRequestedHandlers(*this, nullptr); });
|
||||
|
||||
_BecameMonarchHandlers(*this, nullptr);
|
||||
|
@ -529,7 +529,7 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
|
||||
void WindowManager::SummonAllWindows()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
_monarch.SummonAllWindows();
|
||||
}
|
||||
|
@ -556,28 +556,28 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - Ask the monarch to show a tray icon.
|
||||
// - Ask the monarch to show a notification icon.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
winrt::fire_and_forget WindowManager::RequestShowTrayIcon()
|
||||
winrt::fire_and_forget WindowManager::RequestShowNotificationIcon()
|
||||
{
|
||||
co_await winrt::resume_background();
|
||||
_peasant.RequestShowTrayIcon();
|
||||
_peasant.RequestShowNotificationIcon();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Ask the monarch to hide its tray icon.
|
||||
// - Ask the monarch to hide its notification icon.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
winrt::fire_and_forget WindowManager::RequestHideTrayIcon()
|
||||
winrt::fire_and_forget WindowManager::RequestHideNotificationIcon()
|
||||
{
|
||||
auto strongThis{ get_strong() };
|
||||
co_await winrt::resume_background();
|
||||
_peasant.RequestHideTrayIcon();
|
||||
_peasant.RequestHideNotificationIcon();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
uint64_t GetNumberOfPeasants();
|
||||
Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo> GetPeasantInfos();
|
||||
|
||||
winrt::fire_and_forget RequestShowTrayIcon();
|
||||
winrt::fire_and_forget RequestHideTrayIcon();
|
||||
winrt::fire_and_forget RequestShowNotificationIcon();
|
||||
winrt::fire_and_forget RequestHideNotificationIcon();
|
||||
winrt::fire_and_forget RequestQuitAll();
|
||||
bool DoesQuakeWindowExist();
|
||||
void UpdateActiveTabTitle(winrt::hstring title);
|
||||
|
@ -55,8 +55,8 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|||
TYPED_EVENT(BecameMonarch, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowCreated, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(WindowClosed, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ShowTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
|
||||
private:
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace Microsoft.Terminal.Remoting
|
|||
Boolean IsMonarch { get; };
|
||||
void SummonWindow(SummonWindowSelectionArgs args);
|
||||
void SummonAllWindows();
|
||||
void RequestShowTrayIcon();
|
||||
void RequestHideTrayIcon();
|
||||
void RequestShowNotificationIcon();
|
||||
void RequestHideNotificationIcon();
|
||||
UInt64 GetNumberOfPeasants();
|
||||
void RequestQuitAll();
|
||||
void UpdateActiveTabTitle(String title);
|
||||
|
@ -25,8 +25,8 @@ namespace Microsoft.Terminal.Remoting
|
|||
event Windows.Foundation.TypedEventHandler<Object, Object> BecameMonarch;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> WindowCreated;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> WindowClosed;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> ShowTrayIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> HideTrayIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> ShowNotificationIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> HideNotificationIconRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> QuitAllRequested;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1487,9 +1487,9 @@ namespace winrt::TerminalApp::implementation
|
|||
return _root->IsQuakeWindow();
|
||||
}
|
||||
|
||||
bool AppLogic::GetMinimizeToTray()
|
||||
bool AppLogic::GetMinimizeToNotificationArea()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
if (!_loadedInitialSettings)
|
||||
{
|
||||
|
@ -1497,7 +1497,7 @@ namespace winrt::TerminalApp::implementation
|
|||
LoadSettings();
|
||||
}
|
||||
|
||||
return _settings.GlobalSettings().MinimizeToTray();
|
||||
return _settings.GlobalSettings().MinimizeToNotificationArea();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1505,9 +1505,9 @@ namespace winrt::TerminalApp::implementation
|
|||
}
|
||||
}
|
||||
|
||||
bool AppLogic::GetAlwaysShowTrayIcon()
|
||||
bool AppLogic::GetAlwaysShowNotificationIcon()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
if (!_loadedInitialSettings)
|
||||
{
|
||||
|
@ -1515,7 +1515,7 @@ namespace winrt::TerminalApp::implementation
|
|||
LoadSettings();
|
||||
}
|
||||
|
||||
return _settings.GlobalSettings().AlwaysShowTrayIcon();
|
||||
return _settings.GlobalSettings().AlwaysShowNotificationIcon();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -95,8 +95,8 @@ namespace winrt::TerminalApp::implementation
|
|||
|
||||
winrt::TerminalApp::TaskbarState TaskbarState();
|
||||
|
||||
bool GetMinimizeToTray();
|
||||
bool GetAlwaysShowTrayIcon();
|
||||
bool GetMinimizeToNotificationArea();
|
||||
bool GetAlwaysShowNotificationIcon();
|
||||
bool GetShowTitleInTitlebar();
|
||||
|
||||
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> ShowDialog(winrt::Windows::UI::Xaml::Controls::ContentDialog dialog);
|
||||
|
|
|
@ -73,8 +73,8 @@ namespace TerminalApp
|
|||
|
||||
TaskbarState TaskbarState{ get; };
|
||||
|
||||
Boolean GetMinimizeToTray();
|
||||
Boolean GetAlwaysShowTrayIcon();
|
||||
Boolean GetMinimizeToNotificationArea();
|
||||
Boolean GetAlwaysShowNotificationIcon();
|
||||
Boolean GetShowTitleInTitlebar();
|
||||
|
||||
FindTargetWindowResult FindTargetWindow(String[] args);
|
||||
|
|
|
@ -665,11 +665,11 @@
|
|||
<data name="CommandPaletteMenuItem" xml:space="preserve">
|
||||
<value>Command Palette</value>
|
||||
</data>
|
||||
<data name="TrayIconFocusTerminal" xml:space="preserve">
|
||||
<data name="NotificationIconFocusTerminal" xml:space="preserve">
|
||||
<value>Focus Terminal</value>
|
||||
<comment>This is displayed as a label for the context menu item that focuses the terminal.</comment>
|
||||
</data>
|
||||
<data name="TrayIconWindowSubmenu" xml:space="preserve">
|
||||
<data name="NotificationIconWindowSubmenu" xml:space="preserve">
|
||||
<value>Windows</value>
|
||||
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
|
||||
</data>
|
||||
|
|
|
@ -199,8 +199,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||
}
|
||||
}
|
||||
|
||||
bool GlobalAppearance::FeatureTrayIconEnabled() const noexcept
|
||||
bool GlobalAppearance::FeatureNotificationIconEnabled() const noexcept
|
||||
{
|
||||
return Feature_TrayIcon::IsEnabled();
|
||||
return Feature_NotificationIcon::IsEnabled();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||
|
||||
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
|
||||
|
||||
bool FeatureTrayIconEnabled() const noexcept;
|
||||
bool FeatureNotificationIconEnabled() const noexcept;
|
||||
|
||||
WINRT_PROPERTY(Editor::GlobalAppearancePageNavigationState, State, nullptr);
|
||||
GETSET_BINDABLE_ENUM_SETTING(Theme, winrt::Windows::UI::Xaml::ElementTheme, State().Globals, Theme);
|
||||
|
|
|
@ -26,6 +26,6 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||
IInspectable CurrentTabWidthMode;
|
||||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TabWidthModeList { get; };
|
||||
|
||||
Boolean FeatureTrayIconEnabled { get; };
|
||||
Boolean FeatureNotificationIconEnabled { get; };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,16 +85,16 @@
|
|||
<ToggleSwitch IsOn="{x:Bind local:Converters.InvertBoolean(State.Globals.DisableAnimations), BindBack=State.Globals.SetInvertedDisableAnimationsValue, Mode=TwoWay}" />
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Always Show Tray Icon -->
|
||||
<local:SettingContainer x:Uid="Globals_AlwaysShowTrayIcon"
|
||||
Visibility="{x:Bind FeatureTrayIconEnabled}">
|
||||
<ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysShowTrayIcon, Mode=TwoWay}" />
|
||||
<!-- Always Show Notification Icon -->
|
||||
<local:SettingContainer x:Uid="Globals_AlwaysShowNotificationIcon"
|
||||
Visibility="{x:Bind FeatureNotificationIconEnabled}">
|
||||
<ToggleSwitch IsOn="{x:Bind State.Globals.AlwaysShowNotificationIcon, Mode=TwoWay}" />
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Minimize To Tray -->
|
||||
<local:SettingContainer x:Uid="Globals_MinimizeToTray"
|
||||
Visibility="{x:Bind FeatureTrayIconEnabled}">
|
||||
<ToggleSwitch IsOn="{x:Bind State.Globals.MinimizeToTray, Mode=TwoWay}" />
|
||||
<!-- Minimize To Notification Area -->
|
||||
<local:SettingContainer x:Uid="Globals_MinimizeToNotificationArea"
|
||||
Visibility="{x:Bind FeatureNotificationIconEnabled}">
|
||||
<ToggleSwitch IsOn="{x:Bind State.Globals.MinimizeToNotificationArea, Mode=TwoWay}" />
|
||||
</local:SettingContainer>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
|
|
@ -1106,13 +1106,13 @@
|
|||
<value>Pane animations</value>
|
||||
<comment>Header for a control to toggle animations on panes. "Enabled" value enables the animations.</comment>
|
||||
</data>
|
||||
<data name="Globals_AlwaysShowTrayIcon.Header" xml:space="preserve">
|
||||
<data name="Globals_AlwaysShowNotificationIcon.Header" xml:space="preserve">
|
||||
<value>Always display an icon in the notification area</value>
|
||||
<comment>Header for a control to toggle whether the tray icon should always be shown.</comment>
|
||||
<comment>Header for a control to toggle whether the notification icon should always be shown.</comment>
|
||||
</data>
|
||||
<data name="Globals_MinimizeToTray.Header" xml:space="preserve">
|
||||
<data name="Globals_MinimizeToNotificationArea.Header" xml:space="preserve">
|
||||
<value>Hide Terminal in the notification area when it is minimized</value>
|
||||
<comment>Header for a control to toggle whether the terminal should hide itself in the tray instead of the taskbar when minimized.</comment>
|
||||
<comment>Header for a control to toggle whether the terminal should hide itself in the notification area instead of the taskbar when minimized.</comment>
|
||||
</data>
|
||||
<data name="SettingContainer_OverrideMessageBaseLayer" xml:space="preserve">
|
||||
<value>Reset to inherited value.</value>
|
||||
|
@ -1234,4 +1234,4 @@
|
|||
<value>Bold font with bright colors</value>
|
||||
<comment>An option to choose from for the "intense text format" setting. When selected, "intense" text will be rendered as both bold text and in a brighter color</comment>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
|
|
@ -50,8 +50,8 @@ static constexpr std::string_view StartupActionsKey{ "startupActions" };
|
|||
static constexpr std::string_view FocusFollowMouseKey{ "focusFollowMouse" };
|
||||
static constexpr std::string_view WindowingBehaviorKey{ "windowingBehavior" };
|
||||
static constexpr std::string_view TrimBlockSelectionKey{ "trimBlockSelection" };
|
||||
static constexpr std::string_view AlwaysShowTrayIconKey{ "alwaysShowTrayIcon" };
|
||||
static constexpr std::string_view MinimizeToTrayKey{ "minimizeToTray" };
|
||||
static constexpr std::string_view AlwaysShowNotificationIconKey{ "alwaysShowNotificationIcon" };
|
||||
static constexpr std::string_view MinimizeToNotificationAreaKey{ "minimizeToNotificationArea" };
|
||||
|
||||
static constexpr std::string_view DebugFeaturesKey{ "debugFeatures" };
|
||||
|
||||
|
@ -135,8 +135,8 @@ winrt::com_ptr<GlobalAppSettings> GlobalAppSettings::Copy() const
|
|||
globals->_WindowingBehavior = _WindowingBehavior;
|
||||
globals->_TrimBlockSelection = _TrimBlockSelection;
|
||||
globals->_DetectURLs = _DetectURLs;
|
||||
globals->_MinimizeToTray = _MinimizeToTray;
|
||||
globals->_AlwaysShowTrayIcon = _AlwaysShowTrayIcon;
|
||||
globals->_MinimizeToNotificationArea = _MinimizeToNotificationArea;
|
||||
globals->_AlwaysShowNotificationIcon = _AlwaysShowNotificationIcon;
|
||||
|
||||
globals->_UnparsedDefaultProfile = _UnparsedDefaultProfile;
|
||||
globals->_validDefaultProfile = _validDefaultProfile;
|
||||
|
@ -331,9 +331,9 @@ void GlobalAppSettings::LayerJson(const Json::Value& json)
|
|||
|
||||
JsonUtils::GetValueForKey(json, DetectURLsKey, _DetectURLs);
|
||||
|
||||
JsonUtils::GetValueForKey(json, MinimizeToTrayKey, _MinimizeToTray);
|
||||
JsonUtils::GetValueForKey(json, MinimizeToNotificationAreaKey, _MinimizeToNotificationArea);
|
||||
|
||||
JsonUtils::GetValueForKey(json, AlwaysShowTrayIconKey, _AlwaysShowTrayIcon);
|
||||
JsonUtils::GetValueForKey(json, AlwaysShowNotificationIconKey, _AlwaysShowNotificationIcon);
|
||||
|
||||
// This is a helper lambda to get the keybindings and commands out of both
|
||||
// and array of objects. We'll use this twice, once on the legacy
|
||||
|
@ -432,8 +432,8 @@ Json::Value GlobalAppSettings::ToJson() const
|
|||
JsonUtils::SetValueForKey(json, WindowingBehaviorKey, _WindowingBehavior);
|
||||
JsonUtils::SetValueForKey(json, TrimBlockSelectionKey, _TrimBlockSelection);
|
||||
JsonUtils::SetValueForKey(json, DetectURLsKey, _DetectURLs);
|
||||
JsonUtils::SetValueForKey(json, MinimizeToTrayKey, _MinimizeToTray);
|
||||
JsonUtils::SetValueForKey(json, AlwaysShowTrayIconKey, _AlwaysShowTrayIcon);
|
||||
JsonUtils::SetValueForKey(json, MinimizeToNotificationAreaKey, _MinimizeToNotificationArea);
|
||||
JsonUtils::SetValueForKey(json, AlwaysShowNotificationIconKey, _AlwaysShowNotificationIcon);
|
||||
// clang-format on
|
||||
|
||||
json[JsonKey(ActionsKey)] = _actionMap->ToJson();
|
||||
|
|
|
@ -100,8 +100,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||
INHERITABLE_SETTING(Model::GlobalAppSettings, Model::WindowingMode, WindowingBehavior, Model::WindowingMode::UseNew);
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, TrimBlockSelection, false);
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, DetectURLs, true);
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, MinimizeToTray, false);
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, AlwaysShowTrayIcon, false);
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, MinimizeToNotificationArea, false);
|
||||
INHERITABLE_SETTING(Model::GlobalAppSettings, bool, AlwaysShowNotificationIcon, false);
|
||||
|
||||
private:
|
||||
guid _defaultProfile;
|
||||
|
|
|
@ -81,8 +81,8 @@ namespace Microsoft.Terminal.Settings.Model
|
|||
INHERITABLE_SETTING(WindowingMode, WindowingBehavior);
|
||||
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
||||
INHERITABLE_SETTING(Boolean, DetectURLs);
|
||||
INHERITABLE_SETTING(Boolean, MinimizeToTray);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowTrayIcon);
|
||||
INHERITABLE_SETTING(Boolean, MinimizeToNotificationArea);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowNotificationIcon);
|
||||
|
||||
Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
|
||||
void AddColorScheme(ColorScheme scheme);
|
||||
|
|
|
@ -469,9 +469,6 @@
|
|||
<value>Windows Console Host</value>
|
||||
<comment>Name describing the usage of the classic windows console as the terminal UI. (`conhost.exe`)</comment>
|
||||
</data>
|
||||
<data name="MinimizeToTrayCommandKey" xml:space="preserve">
|
||||
<value>Minimize current window to tray</value>
|
||||
</data>
|
||||
<data name="QuitCommandKey" xml:space="preserve">
|
||||
<value>Quit the Terminal</value>
|
||||
</data>
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
"disableAnimations": false,
|
||||
"startupActions": "",
|
||||
"focusFollowMouse": false,
|
||||
"minimizeToTray": false,
|
||||
"alwaysShowTrayIcon": false,
|
||||
"minimizeToNotificationArea": false,
|
||||
"alwaysShowNotificationIcon": false,
|
||||
|
||||
"profiles":
|
||||
[
|
||||
|
|
|
@ -73,8 +73,8 @@ namespace RemotingUnitTests
|
|||
Remoting::WindowActivatedArgs GetLastActivatedArgs() { throw winrt::hresult_error{}; }
|
||||
void RequestRename(const Remoting::RenameRequestArgs& /*args*/) { throw winrt::hresult_error{}; }
|
||||
void Summon(const Remoting::SummonWindowBehavior& /*args*/) { throw winrt::hresult_error{}; };
|
||||
void RequestShowTrayIcon() { throw winrt::hresult_error{}; };
|
||||
void RequestHideTrayIcon() { throw winrt::hresult_error{}; };
|
||||
void RequestShowNotificationIcon() { throw winrt::hresult_error{}; };
|
||||
void RequestHideNotificationIcon() { throw winrt::hresult_error{}; };
|
||||
void RequestQuitAll() { throw winrt::hresult_error{}; };
|
||||
void Quit() { throw winrt::hresult_error{}; };
|
||||
TYPED_EVENT(WindowActivated, winrt::Windows::Foundation::IInspectable, Remoting::WindowActivatedArgs);
|
||||
|
@ -83,8 +83,8 @@ namespace RemotingUnitTests
|
|||
TYPED_EVENT(DisplayWindowIdRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(RenameRequested, winrt::Windows::Foundation::IInspectable, Remoting::RenameRequestArgs);
|
||||
TYPED_EVENT(SummonRequested, winrt::Windows::Foundation::IInspectable, Remoting::SummonWindowBehavior);
|
||||
TYPED_EVENT(ShowTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideTrayIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(ShowNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(HideNotificationIconRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitAllRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
TYPED_EVENT(QuitRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ AppHost::AppHost() noexcept :
|
|||
// Update our own internal state tracking if we're in quake mode or not.
|
||||
_IsQuakeWindowChanged(nullptr, nullptr);
|
||||
|
||||
_window->SetMinimizeToTrayBehavior(_logic.GetMinimizeToTray());
|
||||
_window->SetMinimizeToNotificationAreaBehavior(_logic.GetMinimizeToNotificationArea());
|
||||
|
||||
// Tell the window to callback to us when it's about to handle a WM_CREATE
|
||||
auto pfn = std::bind(&AppHost::_HandleCreateWindow,
|
||||
|
@ -335,13 +335,13 @@ void AppHost::AppTitleChanged(const winrt::Windows::Foundation::IInspectable& /*
|
|||
// - <none>
|
||||
void AppHost::LastTabClosed(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::TerminalApp::LastTabClosedEventArgs& /*args*/)
|
||||
{
|
||||
if (_windowManager.IsMonarch() && _trayIcon)
|
||||
if (_windowManager.IsMonarch() && _notificationIcon)
|
||||
{
|
||||
_DestroyTrayIcon();
|
||||
_DestroyNotificationIcon();
|
||||
}
|
||||
else if (_window->IsQuakeWindow())
|
||||
{
|
||||
_HideTrayIconRequested();
|
||||
_HideNotificationIconRequested();
|
||||
}
|
||||
|
||||
_window->Close();
|
||||
|
@ -678,9 +678,9 @@ void AppHost::_BecomeMonarch(const winrt::Windows::Foundation::IInspectable& /*s
|
|||
|
||||
if (_windowManager.DoesQuakeWindowExist() ||
|
||||
_window->IsQuakeWindow() ||
|
||||
(_logic.GetAlwaysShowTrayIcon() || _logic.GetMinimizeToTray()))
|
||||
(_logic.GetAlwaysShowNotificationIcon() || _logic.GetMinimizeToNotificationArea()))
|
||||
{
|
||||
_CreateTrayIcon();
|
||||
_CreateNotificationIcon();
|
||||
}
|
||||
|
||||
// Set the number of open windows (so we know if we are the last window)
|
||||
|
@ -691,8 +691,8 @@ void AppHost::_BecomeMonarch(const winrt::Windows::Foundation::IInspectable& /*s
|
|||
_windowManager.WindowClosed([this](auto&&, auto&&) { _logic.SetNumberOfOpenWindows(_windowManager.GetNumberOfPeasants()); });
|
||||
|
||||
// These events are coming from peasants that become or un-become quake windows.
|
||||
_windowManager.ShowTrayIconRequested([this](auto&&, auto&&) { _ShowTrayIconRequested(); });
|
||||
_windowManager.HideTrayIconRequested([this](auto&&, auto&&) { _HideTrayIconRequested(); });
|
||||
_windowManager.ShowNotificationIconRequested([this](auto&&, auto&&) { _ShowNotificationIconRequested(); });
|
||||
_windowManager.HideNotificationIconRequested([this](auto&&, auto&&) { _HideNotificationIconRequested(); });
|
||||
// If the monarch receives a QuitAll event it will signal this event to be
|
||||
// ran before each peasant is closed.
|
||||
_windowManager.QuitAllRequested({ this, &AppHost::_QuitAllRequested });
|
||||
|
@ -982,12 +982,12 @@ void AppHost::_HandleSettingsChanged(const winrt::Windows::Foundation::IInspecta
|
|||
{
|
||||
_setupGlobalHotkeys();
|
||||
|
||||
// If we're monarch, we need to check some conditions to show the tray icon.
|
||||
// If there's a Quake window somewhere, we'll want to keep the tray icon.
|
||||
// There's two settings - MinimizeToTray and AlwaysShowTrayIcon. If either
|
||||
// one of them are true, we want to make sure there's a tray icon.
|
||||
// If both are false, we want to remove our icon from the tray.
|
||||
// When we remove our icon from the tray, we'll also want to re-summon
|
||||
// If we're monarch, we need to check some conditions to show the notification icon.
|
||||
// If there's a Quake window somewhere, we'll want to keep the notification icon.
|
||||
// There's two settings - MinimizeToNotificationArea and AlwaysShowNotificationIcon. If either
|
||||
// one of them are true, we want to make sure there's a notification icon.
|
||||
// If both are false, we want to remove our icon from the notification area.
|
||||
// When we remove our icon from the notification area, we'll also want to re-summon
|
||||
// any hidden windows, but right now we're not keeping track of who's hidden,
|
||||
// so just summon them all. Tracking the work to do a "summon all minimized" in
|
||||
// GH#10448
|
||||
|
@ -995,36 +995,36 @@ void AppHost::_HandleSettingsChanged(const winrt::Windows::Foundation::IInspecta
|
|||
{
|
||||
if (!_windowManager.DoesQuakeWindowExist())
|
||||
{
|
||||
if (!_trayIcon && (_logic.GetMinimizeToTray() || _logic.GetAlwaysShowTrayIcon()))
|
||||
if (!_notificationIcon && (_logic.GetMinimizeToNotificationArea() || _logic.GetAlwaysShowNotificationIcon()))
|
||||
{
|
||||
_CreateTrayIcon();
|
||||
_CreateNotificationIcon();
|
||||
}
|
||||
else if (_trayIcon && !_logic.GetMinimizeToTray() && !_logic.GetAlwaysShowTrayIcon())
|
||||
else if (_notificationIcon && !_logic.GetMinimizeToNotificationArea() && !_logic.GetAlwaysShowNotificationIcon())
|
||||
{
|
||||
_windowManager.SummonAllWindows();
|
||||
_DestroyTrayIcon();
|
||||
_DestroyNotificationIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_window->SetMinimizeToTrayBehavior(_logic.GetMinimizeToTray());
|
||||
_window->SetMinimizeToNotificationAreaBehavior(_logic.GetMinimizeToNotificationArea());
|
||||
}
|
||||
|
||||
void AppHost::_IsQuakeWindowChanged(const winrt::Windows::Foundation::IInspectable&,
|
||||
const winrt::Windows::Foundation::IInspectable&)
|
||||
{
|
||||
// We want the quake window to be accessible through the tray icon.
|
||||
// This means if there's a quake window _somewhere_, we want the tray icon
|
||||
// to show regardless of the tray icon settings.
|
||||
// This also means we'll need to destroy the tray icon if it was created
|
||||
// We want the quake window to be accessible through the notification icon.
|
||||
// This means if there's a quake window _somewhere_, we want the notification icon
|
||||
// to show regardless of the notification icon settings.
|
||||
// This also means we'll need to destroy the notification icon if it was created
|
||||
// specifically for the quake window. If not, it should not be destroyed.
|
||||
if (!_window->IsQuakeWindow() && _logic.IsQuakeWindow())
|
||||
{
|
||||
_ShowTrayIconRequested();
|
||||
_ShowNotificationIconRequested();
|
||||
}
|
||||
else if (_window->IsQuakeWindow() && !_logic.IsQuakeWindow())
|
||||
{
|
||||
_HideTrayIconRequested();
|
||||
_HideNotificationIconRequested();
|
||||
}
|
||||
|
||||
_window->IsQuakeWindow(_logic.IsQuakeWindow());
|
||||
|
@ -1070,81 +1070,81 @@ void AppHost::_OpenSystemMenu(const winrt::Windows::Foundation::IInspectable&,
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - Creates a Tray Icon and hooks up its handlers
|
||||
// - Creates a Notification Icon and hooks up its handlers
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void AppHost::_CreateTrayIcon()
|
||||
void AppHost::_CreateNotificationIcon()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
_trayIcon = std::make_unique<TrayIcon>(_window->GetHandle());
|
||||
_notificationIcon = std::make_unique<NotificationIcon>(_window->GetHandle());
|
||||
|
||||
// Hookup the handlers, save the tokens for revoking if settings change.
|
||||
_ReAddTrayIconToken = _window->NotifyReAddTrayIcon([this]() { _trayIcon->ReAddTrayIcon(); });
|
||||
_TrayIconPressedToken = _window->NotifyTrayIconPressed([this]() { _trayIcon->TrayIconPressed(); });
|
||||
_ShowTrayContextMenuToken = _window->NotifyShowTrayContextMenu([this](til::point coord) { _trayIcon->ShowTrayContextMenu(coord, _windowManager.GetPeasantInfos()); });
|
||||
_TrayMenuItemSelectedToken = _window->NotifyTrayMenuItemSelected([this](HMENU hm, UINT idx) { _trayIcon->TrayMenuItemSelected(hm, idx); });
|
||||
_trayIcon->SummonWindowRequested([this](auto& args) { _windowManager.SummonWindow(args); });
|
||||
_ReAddNotificationIconToken = _window->NotifyReAddNotificationIcon([this]() { _notificationIcon->ReAddNotificationIcon(); });
|
||||
_NotificationIconPressedToken = _window->NotifyNotificationIconPressed([this]() { _notificationIcon->NotificationIconPressed(); });
|
||||
_ShowNotificationIconContextMenuToken = _window->NotifyShowNotificationIconContextMenu([this](til::point coord) { _notificationIcon->ShowContextMenu(coord, _windowManager.GetPeasantInfos()); });
|
||||
_NotificationIconMenuItemSelectedToken = _window->NotifyNotificationIconMenuItemSelected([this](HMENU hm, UINT idx) { _notificationIcon->MenuItemSelected(hm, idx); });
|
||||
_notificationIcon->SummonWindowRequested([this](auto& args) { _windowManager.SummonWindow(args); });
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Deletes our tray icon if we have one.
|
||||
// - Deletes our notification icon if we have one.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void AppHost::_DestroyTrayIcon()
|
||||
void AppHost::_DestroyNotificationIcon()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
_window->NotifyReAddTrayIcon(_ReAddTrayIconToken);
|
||||
_window->NotifyTrayIconPressed(_TrayIconPressedToken);
|
||||
_window->NotifyShowTrayContextMenu(_ShowTrayContextMenuToken);
|
||||
_window->NotifyTrayMenuItemSelected(_TrayMenuItemSelectedToken);
|
||||
_window->NotifyReAddNotificationIcon(_ReAddNotificationIconToken);
|
||||
_window->NotifyNotificationIconPressed(_NotificationIconPressedToken);
|
||||
_window->NotifyShowNotificationIconContextMenu(_ShowNotificationIconContextMenuToken);
|
||||
_window->NotifyNotificationIconMenuItemSelected(_NotificationIconMenuItemSelectedToken);
|
||||
|
||||
_trayIcon->RemoveIconFromTray();
|
||||
_trayIcon = nullptr;
|
||||
_notificationIcon->RemoveIconFromNotificationArea();
|
||||
_notificationIcon = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void AppHost::_ShowTrayIconRequested()
|
||||
void AppHost::_ShowNotificationIconRequested()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
if (_windowManager.IsMonarch())
|
||||
{
|
||||
if (!_trayIcon)
|
||||
if (!_notificationIcon)
|
||||
{
|
||||
_CreateTrayIcon();
|
||||
_CreateNotificationIcon();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_windowManager.RequestShowTrayIcon();
|
||||
_windowManager.RequestShowNotificationIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppHost::_HideTrayIconRequested()
|
||||
void AppHost::_HideNotificationIconRequested()
|
||||
{
|
||||
if constexpr (Feature_TrayIcon::IsEnabled())
|
||||
if constexpr (Feature_NotificationIcon::IsEnabled())
|
||||
{
|
||||
if (_windowManager.IsMonarch())
|
||||
{
|
||||
// Destroy it only if our settings allow it
|
||||
if (_trayIcon &&
|
||||
!_logic.GetAlwaysShowTrayIcon() &&
|
||||
!_logic.GetMinimizeToTray())
|
||||
if (_notificationIcon &&
|
||||
!_logic.GetAlwaysShowNotificationIcon() &&
|
||||
!_logic.GetMinimizeToNotificationArea())
|
||||
{
|
||||
_DestroyTrayIcon();
|
||||
_DestroyNotificationIcon();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_windowManager.RequestHideTrayIcon();
|
||||
_windowManager.RequestHideNotificationIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "NonClientIslandWindow.h"
|
||||
#include "TrayIcon.h"
|
||||
#include "NotificationIcon.h"
|
||||
|
||||
class AppHost
|
||||
{
|
||||
|
@ -97,13 +97,13 @@ private:
|
|||
void _QuitAllRequested(const winrt::Windows::Foundation::IInspectable& sender,
|
||||
const winrt::Windows::Foundation::IInspectable& args);
|
||||
|
||||
void _CreateTrayIcon();
|
||||
void _DestroyTrayIcon();
|
||||
void _ShowTrayIconRequested();
|
||||
void _HideTrayIconRequested();
|
||||
std::unique_ptr<TrayIcon> _trayIcon;
|
||||
winrt::event_token _ReAddTrayIconToken;
|
||||
winrt::event_token _TrayIconPressedToken;
|
||||
winrt::event_token _ShowTrayContextMenuToken;
|
||||
winrt::event_token _TrayMenuItemSelectedToken;
|
||||
void _CreateNotificationIcon();
|
||||
void _DestroyNotificationIcon();
|
||||
void _ShowNotificationIconRequested();
|
||||
void _HideNotificationIconRequested();
|
||||
std::unique_ptr<NotificationIcon> _notificationIcon;
|
||||
winrt::event_token _ReAddNotificationIconToken;
|
||||
winrt::event_token _NotificationIconPressedToken;
|
||||
winrt::event_token _ShowNotificationIconContextMenuToken;
|
||||
winrt::event_token _NotificationIconMenuItemSelectedToken;
|
||||
};
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
|
||||
// Custom window messages
|
||||
#define CM_UPDATE_TITLE (WM_USER)
|
||||
#define CM_NOTIFY_FROM_TRAY (WM_USER + 1)
|
||||
#define CM_NOTIFY_FROM_NOTIFICATION_AREA (WM_USER + 1)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "../types/inc/Viewport.hpp"
|
||||
#include "resource.h"
|
||||
#include "icon.h"
|
||||
#include "TrayIcon.h"
|
||||
#include "NotificationIcon.h"
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
|
@ -570,20 +570,20 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize
|
|||
}
|
||||
}
|
||||
}
|
||||
case CM_NOTIFY_FROM_TRAY:
|
||||
case CM_NOTIFY_FROM_NOTIFICATION_AREA:
|
||||
{
|
||||
switch (LOWORD(lparam))
|
||||
{
|
||||
case NIN_SELECT:
|
||||
case NIN_KEYSELECT:
|
||||
{
|
||||
_NotifyTrayIconPressedHandlers();
|
||||
_NotifyNotificationIconPressedHandlers();
|
||||
return 0;
|
||||
}
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
const til::point eventPoint{ GET_X_LPARAM(wparam), GET_Y_LPARAM(wparam) };
|
||||
_NotifyShowTrayContextMenuHandlers(eventPoint);
|
||||
_NotifyShowNotificationIconContextMenuHandlers(eventPoint);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -591,17 +591,17 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize
|
|||
}
|
||||
case WM_MENUCOMMAND:
|
||||
{
|
||||
_NotifyTrayMenuItemSelectedHandlers((HMENU)lparam, (UINT)wparam);
|
||||
_NotifyNotificationIconMenuItemSelectedHandlers((HMENU)lparam, (UINT)wparam);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
// We'll want to receive this message when explorer.exe restarts
|
||||
// so that we can re-add our icon to the tray.
|
||||
// so that we can re-add our icon to the notification area.
|
||||
// This unfortunately isn't a switch case because we register the
|
||||
// message at runtime.
|
||||
if (message == WM_TASKBARCREATED)
|
||||
{
|
||||
_NotifyReAddTrayIconHandlers();
|
||||
_NotifyReAddNotificationIconHandlers();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -628,7 +628,7 @@ void IslandWindow::OnResize(const UINT width, const UINT height)
|
|||
void IslandWindow::OnMinimize()
|
||||
{
|
||||
// TODO GH#1989 Stop rendering island content when the app is minimized.
|
||||
if (_minimizeToTray)
|
||||
if (_minimizeToNotificationArea)
|
||||
{
|
||||
HideWindow();
|
||||
}
|
||||
|
@ -1640,9 +1640,9 @@ void IslandWindow::HideWindow()
|
|||
ShowWindow(GetHandle(), SW_HIDE);
|
||||
}
|
||||
|
||||
void IslandWindow::SetMinimizeToTrayBehavior(bool minimizeToTray) noexcept
|
||||
void IslandWindow::SetMinimizeToNotificationAreaBehavior(bool MinimizeToNotificationArea) noexcept
|
||||
{
|
||||
_minimizeToTray = minimizeToTray;
|
||||
_minimizeToNotificationArea = MinimizeToNotificationArea;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
void HideWindow();
|
||||
|
||||
void SetMinimizeToTrayBehavior(bool minimizeToTray) noexcept;
|
||||
void SetMinimizeToNotificationAreaBehavior(bool MinimizeToNotificationArea) noexcept;
|
||||
|
||||
void OpenSystemMenu(const std::optional<int> mouseX, const std::optional<int> mouseY) const noexcept;
|
||||
|
||||
|
@ -58,11 +58,11 @@ public:
|
|||
WINRT_CALLBACK(MouseScrolled, winrt::delegate<void(til::point, int32_t)>);
|
||||
WINRT_CALLBACK(WindowActivated, winrt::delegate<void()>);
|
||||
WINRT_CALLBACK(HotkeyPressed, winrt::delegate<void(long)>);
|
||||
WINRT_CALLBACK(NotifyTrayIconPressed, winrt::delegate<void()>);
|
||||
WINRT_CALLBACK(NotifyNotificationIconPressed, winrt::delegate<void()>);
|
||||
WINRT_CALLBACK(NotifyWindowHidden, winrt::delegate<void()>);
|
||||
WINRT_CALLBACK(NotifyShowTrayContextMenu, winrt::delegate<void(til::point)>);
|
||||
WINRT_CALLBACK(NotifyTrayMenuItemSelected, winrt::delegate<void(HMENU, UINT)>);
|
||||
WINRT_CALLBACK(NotifyReAddTrayIcon, winrt::delegate<void()>);
|
||||
WINRT_CALLBACK(NotifyShowNotificationIconContextMenu, winrt::delegate<void(til::point)>);
|
||||
WINRT_CALLBACK(NotifyNotificationIconMenuItemSelected, winrt::delegate<void(HMENU, UINT)>);
|
||||
WINRT_CALLBACK(NotifyReAddNotificationIcon, winrt::delegate<void()>);
|
||||
|
||||
WINRT_CALLBACK(WindowMoved, winrt::delegate<void()>);
|
||||
|
||||
|
@ -127,7 +127,7 @@ protected:
|
|||
|
||||
void _summonWindowRoutineBody(winrt::Microsoft::Terminal::Remoting::SummonWindowBehavior args);
|
||||
|
||||
bool _minimizeToTray{ false };
|
||||
bool _minimizeToNotificationArea{ false };
|
||||
|
||||
private:
|
||||
// This minimum width allows for width the tabs fit
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "icon.h"
|
||||
#include "TrayIcon.h"
|
||||
#include "NotificationIcon.h"
|
||||
#include "CustomWindowMessages.h"
|
||||
|
||||
#include <ScopedResourceLoader.h>
|
||||
|
@ -12,54 +12,54 @@
|
|||
using namespace winrt::Windows::Foundation::Collections;
|
||||
using namespace winrt::Microsoft::Terminal;
|
||||
|
||||
TrayIcon::TrayIcon(const HWND owningHwnd) :
|
||||
NotificationIcon::NotificationIcon(const HWND owningHwnd) :
|
||||
_owningHwnd{ owningHwnd }
|
||||
{
|
||||
CreateTrayIcon();
|
||||
CreateNotificationIcon();
|
||||
}
|
||||
|
||||
TrayIcon::~TrayIcon()
|
||||
NotificationIcon::~NotificationIcon()
|
||||
{
|
||||
RemoveIconFromTray();
|
||||
RemoveIconFromNotificationArea();
|
||||
}
|
||||
|
||||
void TrayIcon::_CreateWindow()
|
||||
void NotificationIcon::_CreateWindow()
|
||||
{
|
||||
WNDCLASSW wc{};
|
||||
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wc.hInstance = wil::GetModuleInstanceHandle();
|
||||
wc.lpszClassName = L"TRAY_ICON_HOSTING_WINDOW_CLASS";
|
||||
wc.lpszClassName = L"NOTIFICATION_ICON_HOSTING_WINDOW_CLASS";
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = DefWindowProcW;
|
||||
wc.hIcon = static_cast<HICON>(GetActiveAppIconHandle(true));
|
||||
RegisterClass(&wc);
|
||||
|
||||
_trayIconHwnd = wil::unique_hwnd(CreateWindowW(wc.lpszClassName,
|
||||
wc.lpszClassName,
|
||||
WS_DISABLED,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
HWND_MESSAGE,
|
||||
nullptr,
|
||||
wc.hInstance,
|
||||
nullptr));
|
||||
_notificationIconHwnd = wil::unique_hwnd(CreateWindowW(wc.lpszClassName,
|
||||
wc.lpszClassName,
|
||||
WS_DISABLED,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
HWND_MESSAGE,
|
||||
nullptr,
|
||||
wc.hInstance,
|
||||
nullptr));
|
||||
|
||||
WINRT_VERIFY(_trayIconHwnd);
|
||||
WINRT_VERIFY(_notificationIconHwnd);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Creates and adds an icon to the notification tray.
|
||||
// - Creates and adds an icon to the notification area.
|
||||
// If an icon already exists, update the HWND associated
|
||||
// to the icon with this window's HWND.
|
||||
// Arguments:
|
||||
// - <unused>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TrayIcon::CreateTrayIcon()
|
||||
void NotificationIcon::CreateNotificationIcon()
|
||||
{
|
||||
if (!_trayIconHwnd)
|
||||
if (!_notificationIconHwnd)
|
||||
{
|
||||
// Creating a disabled, non visible window just so we can set it
|
||||
// as the foreground window when showing the context menu.
|
||||
|
@ -71,7 +71,7 @@ void TrayIcon::CreateTrayIcon()
|
|||
NOTIFYICONDATA nid{};
|
||||
nid.cbSize = sizeof(NOTIFYICONDATA);
|
||||
|
||||
// This HWND will receive the callbacks sent by the tray icon.
|
||||
// This HWND will receive the callbacks sent by the notification icon.
|
||||
nid.hWnd = _owningHwnd;
|
||||
|
||||
// App-defined identifier of the icon. The HWND and ID are used
|
||||
|
@ -80,7 +80,7 @@ void TrayIcon::CreateTrayIcon()
|
|||
// going to be showing one so the ID doesn't really matter.
|
||||
nid.uID = 1;
|
||||
|
||||
nid.uCallbackMessage = CM_NOTIFY_FROM_TRAY;
|
||||
nid.uCallbackMessage = CM_NOTIFY_FROM_NOTIFICATION_AREA;
|
||||
|
||||
// AppName happens to be in CascadiaPackage's Resources.
|
||||
ScopedResourceLoader loader{ L"Resources" };
|
||||
|
@ -98,7 +98,7 @@ void TrayIcon::CreateTrayIcon()
|
|||
nid.uVersion = NOTIFYICON_VERSION_4;
|
||||
Shell_NotifyIcon(NIM_SETVERSION, &nid);
|
||||
|
||||
_trayIconData = nid;
|
||||
_notificationIconData = nid;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
@ -109,14 +109,14 @@ void TrayIcon::CreateTrayIcon()
|
|||
// - peasants: The map of all peasants that should be available in the context menu.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TrayIcon::ShowTrayContextMenu(const til::point& coord,
|
||||
const IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants)
|
||||
void NotificationIcon::ShowContextMenu(const til::point& coord,
|
||||
const IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants)
|
||||
{
|
||||
if (const auto hMenu = _CreateTrayContextMenu(peasants))
|
||||
if (const auto hMenu = _CreateContextMenu(peasants))
|
||||
{
|
||||
// We'll need to set our window to the foreground before calling
|
||||
// TrackPopupMenuEx or else the menu won't dismiss when clicking away.
|
||||
SetForegroundWindow(_trayIconHwnd.get());
|
||||
SetForegroundWindow(_notificationIconHwnd.get());
|
||||
|
||||
// User can select menu items with the left and right buttons.
|
||||
UINT uFlags = TPM_RIGHTBUTTON;
|
||||
|
@ -137,12 +137,12 @@ void TrayIcon::ShowTrayContextMenu(const til::point& coord,
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - This creates the context menu for our tray icon.
|
||||
// - This creates the context menu for our notification icon.
|
||||
// Arguments:
|
||||
// - peasants: A map of all peasants' ID to their window name.
|
||||
// Return Value:
|
||||
// - The handle to the newly created context menu.
|
||||
HMENU TrayIcon::_CreateTrayContextMenu(const IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants)
|
||||
HMENU NotificationIcon::_CreateContextMenu(const IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants)
|
||||
{
|
||||
auto hMenu = CreatePopupMenu();
|
||||
if (hMenu)
|
||||
|
@ -155,7 +155,7 @@ HMENU TrayIcon::_CreateTrayContextMenu(const IVectorView<winrt::Microsoft::Termi
|
|||
SetMenuInfo(hMenu, &mi);
|
||||
|
||||
// Focus Current Terminal Window
|
||||
AppendMenu(hMenu, MF_STRING, gsl::narrow<UINT_PTR>(TrayMenuItemAction::FocusTerminal), RS_(L"TrayIconFocusTerminal").c_str());
|
||||
AppendMenu(hMenu, MF_STRING, gsl::narrow<UINT_PTR>(NotificationIconMenuItemAction::FocusTerminal), RS_(L"NotificationIconFocusTerminal").c_str());
|
||||
AppendMenu(hMenu, MF_SEPARATOR, 0, L"");
|
||||
|
||||
// Submenu for Windows
|
||||
|
@ -183,10 +183,10 @@ HMENU TrayIcon::_CreateTrayContextMenu(const IVectorView<winrt::Microsoft::Termi
|
|||
submenuInfo.cbSize = sizeof(MENUINFO);
|
||||
submenuInfo.fMask = MIM_MENUDATA;
|
||||
submenuInfo.dwStyle = MNS_NOTIFYBYPOS;
|
||||
submenuInfo.dwMenuData = (UINT_PTR)TrayMenuItemAction::SummonWindow;
|
||||
submenuInfo.dwMenuData = (UINT_PTR)NotificationIconMenuItemAction::SummonWindow;
|
||||
SetMenuInfo(submenu, &submenuInfo);
|
||||
|
||||
AppendMenu(hMenu, MF_POPUP, (UINT_PTR)submenu, RS_(L"TrayIconWindowSubmenu").c_str());
|
||||
AppendMenu(hMenu, MF_POPUP, (UINT_PTR)submenu, RS_(L"NotificationIconWindowSubmenu").c_str());
|
||||
}
|
||||
}
|
||||
return hMenu;
|
||||
|
@ -194,13 +194,13 @@ HMENU TrayIcon::_CreateTrayContextMenu(const IVectorView<winrt::Microsoft::Termi
|
|||
|
||||
// Method Description:
|
||||
// - This is the handler for when one of the menu items are selected within
|
||||
// the tray icon's context menu.
|
||||
// the notification icon's context menu.
|
||||
// Arguments:
|
||||
// - menu: The handle to the menu that holds the menu item that was selected.
|
||||
// - menuItemIndex: The index of the menu item within the given menu.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TrayIcon::TrayMenuItemSelected(const HMENU menu, const UINT menuItemIndex)
|
||||
void NotificationIcon::MenuItemSelected(const HMENU menu, const UINT menuItemIndex)
|
||||
{
|
||||
// Check the menu's data for a specific action.
|
||||
MENUINFO mi{};
|
||||
|
@ -209,7 +209,7 @@ void TrayIcon::TrayMenuItemSelected(const HMENU menu, const UINT menuItemIndex)
|
|||
GetMenuInfo(menu, &mi);
|
||||
if (mi.dwMenuData)
|
||||
{
|
||||
if (gsl::narrow<TrayMenuItemAction>(mi.dwMenuData) == TrayMenuItemAction::SummonWindow)
|
||||
if (gsl::narrow<NotificationIconMenuItemAction>(mi.dwMenuData) == NotificationIconMenuItemAction::SummonWindow)
|
||||
{
|
||||
winrt::Microsoft::Terminal::Remoting::SummonWindowSelectionArgs args{};
|
||||
args.WindowID(GetMenuItemID(menu, menuItemIndex));
|
||||
|
@ -222,10 +222,10 @@ void TrayIcon::TrayMenuItemSelected(const HMENU menu, const UINT menuItemIndex)
|
|||
}
|
||||
|
||||
// Now check the menu item itself for an action.
|
||||
const auto action = gsl::narrow<TrayMenuItemAction>(GetMenuItemID(menu, menuItemIndex));
|
||||
const auto action = gsl::narrow<NotificationIconMenuItemAction>(GetMenuItemID(menu, menuItemIndex));
|
||||
switch (action)
|
||||
{
|
||||
case TrayMenuItemAction::FocusTerminal:
|
||||
case NotificationIconMenuItemAction::FocusTerminal:
|
||||
{
|
||||
winrt::Microsoft::Terminal::Remoting::SummonWindowSelectionArgs args{};
|
||||
args.SummonBehavior().ToggleVisibility(false);
|
||||
|
@ -238,12 +238,12 @@ void TrayIcon::TrayMenuItemSelected(const HMENU menu, const UINT menuItemIndex)
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - This is the handler for when the tray icon itself is left-clicked.
|
||||
// - This is the handler for when the notification icon itself is left-clicked.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TrayIcon::TrayIconPressed()
|
||||
void NotificationIcon::NotificationIconPressed()
|
||||
{
|
||||
// No name in the args means summon the mru window.
|
||||
winrt::Microsoft::Terminal::Remoting::SummonWindowSelectionArgs args{};
|
||||
|
@ -254,24 +254,24 @@ void TrayIcon::TrayIconPressed()
|
|||
}
|
||||
|
||||
// Method Description:
|
||||
// - Re-add a tray icon using our currently saved tray icon data.
|
||||
// - Re-add a notification icon using our currently saved notification icon data.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TrayIcon::ReAddTrayIcon()
|
||||
void NotificationIcon::ReAddNotificationIcon()
|
||||
{
|
||||
Shell_NotifyIcon(NIM_ADD, &_trayIconData);
|
||||
Shell_NotifyIcon(NIM_SETVERSION, &_trayIconData);
|
||||
Shell_NotifyIcon(NIM_ADD, &_notificationIconData);
|
||||
Shell_NotifyIcon(NIM_SETVERSION, &_notificationIconData);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Deletes our tray icon.
|
||||
// - Deletes our notification icon.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TrayIcon::RemoveIconFromTray()
|
||||
void NotificationIcon::RemoveIconFromNotificationArea()
|
||||
{
|
||||
Shell_NotifyIcon(NIM_DELETE, &_trayIconData);
|
||||
Shell_NotifyIcon(NIM_DELETE, &_notificationIconData);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
// This enumerates all the possible actions
|
||||
// that our notification icon context menu could do.
|
||||
enum class NotificationIconMenuItemAction
|
||||
{
|
||||
FocusTerminal, // Focus the MRU terminal.
|
||||
SummonWindow
|
||||
};
|
||||
|
||||
class NotificationIcon
|
||||
{
|
||||
public:
|
||||
NotificationIcon() = delete;
|
||||
NotificationIcon(const HWND owningHwnd);
|
||||
~NotificationIcon();
|
||||
|
||||
void CreateNotificationIcon();
|
||||
void RemoveIconFromNotificationArea();
|
||||
void ReAddNotificationIcon();
|
||||
|
||||
void NotificationIconPressed();
|
||||
void ShowContextMenu(const til::point& coord, const winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants);
|
||||
void MenuItemSelected(const HMENU menu, const UINT menuItemIndex);
|
||||
|
||||
WINRT_CALLBACK(SummonWindowRequested, winrt::delegate<void(winrt::Microsoft::Terminal::Remoting::SummonWindowSelectionArgs)>);
|
||||
|
||||
private:
|
||||
void _CreateWindow();
|
||||
HMENU _CreateContextMenu(const winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants);
|
||||
|
||||
wil::unique_hwnd _notificationIconHwnd;
|
||||
HWND _owningHwnd;
|
||||
NOTIFYICONDATA _notificationIconData;
|
||||
};
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "../cascadia/inc/cppwinrt_utils.h"
|
||||
|
||||
// This enumerates all the possible actions
|
||||
// that our tray icon context menu could do.
|
||||
enum class TrayMenuItemAction
|
||||
{
|
||||
FocusTerminal, // Focus the MRU terminal.
|
||||
SummonWindow
|
||||
};
|
||||
|
||||
class TrayIcon
|
||||
{
|
||||
public:
|
||||
TrayIcon() = delete;
|
||||
TrayIcon(const HWND owningHwnd);
|
||||
~TrayIcon();
|
||||
|
||||
void CreateTrayIcon();
|
||||
void RemoveIconFromTray();
|
||||
void ReAddTrayIcon();
|
||||
|
||||
void TrayIconPressed();
|
||||
void ShowTrayContextMenu(const til::point& coord, const winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants);
|
||||
void TrayMenuItemSelected(const HMENU menu, const UINT menuItemIndex);
|
||||
|
||||
WINRT_CALLBACK(SummonWindowRequested, winrt::delegate<void(winrt::Microsoft::Terminal::Remoting::SummonWindowSelectionArgs)>);
|
||||
|
||||
private:
|
||||
void _CreateWindow();
|
||||
HMENU _CreateTrayContextMenu(const winrt::Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Terminal::Remoting::PeasantInfo>& peasants);
|
||||
|
||||
wil::unique_hwnd _trayIconHwnd;
|
||||
HWND _owningHwnd;
|
||||
NOTIFYICONDATA _trayIconData;
|
||||
};
|
|
@ -47,7 +47,7 @@
|
|||
<ClInclude Include="CustomWindowMessages.h" />
|
||||
<ClInclude Include="IslandWindow.h" />
|
||||
<ClInclude Include="NonClientIslandWindow.h" />
|
||||
<ClInclude Include="TrayIcon.h" />
|
||||
<ClInclude Include="NotificationIcon.h" />
|
||||
<ClInclude Include="VirtualDesktopUtils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -58,7 +58,7 @@
|
|||
<ClCompile Include="AppHost.cpp" />
|
||||
<ClCompile Include="IslandWindow.cpp" />
|
||||
<ClCompile Include="NonClientIslandWindow.cpp" />
|
||||
<ClCompile Include="TrayIcon.cpp" />
|
||||
<ClCompile Include="NotificationIcon.cpp" />
|
||||
<ClCompile Include="VirtualDesktopUtils.cpp" />
|
||||
<ClCompile Include="icon.cpp" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -25,7 +25,7 @@ TRACELOGGING_DEFINE_PROVIDER(
|
|||
// !! BODGY !!
|
||||
// Manually use the resources from TerminalApp as our resources.
|
||||
// The WindowsTerminal project doesn't actually build a Resources.resw file, but
|
||||
// we still need to be able to localize strings for the tray icon menu. Anything
|
||||
// we still need to be able to localize strings for the notification icon menu. Anything
|
||||
// you want localized for WindowsTerminal.exe should be stuck in
|
||||
// ...\TerminalApp\Resources\en-US\Resources.resw
|
||||
#include <LibraryResources.h>
|
||||
|
|
|
@ -65,8 +65,8 @@
|
|||
</feature>
|
||||
|
||||
<feature>
|
||||
<name>Feature_TrayIcon</name>
|
||||
<description>Controls whether the Tray Icon and related settings (aka. MinimizeToTray and AlwaysShowTrayIcon) are enabled</description>
|
||||
<name>Feature_NotificationIcon</name>
|
||||
<description>Controls whether the Notification Icon and related settings (aka. MinimizeToNotificationArea and AlwaysShowNotificationIcon) are enabled</description>
|
||||
<stage>AlwaysEnabled</stage>
|
||||
<alwaysDisabledReleaseTokens/>
|
||||
</feature>
|
||||
|
|
Loading…
Reference in New Issue