From 96e6542cf1b3d045814b9e809ca7e7e1d4dc23ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pol=C3=A1=C5=A1ek?= Date: Fri, 27 Feb 2026 22:11:27 +0100 Subject: [PATCH] Dock: Replace IsShownInSwitchers with HiddenOwnerWindowBehavior in DockWindow (#45839) ## Summary of the Pull Request This PR replaces the use of the property AppWindow.IsShownInSwitchers, which requires a running explorer.exe instance, with HiddenOwnerWindowBehavior. This behavior is used by MainWindow and ToastWindow to hide the window by utilizing both the Tool Window style and a safely invoked IsShownInSwitchers. --- .../cmdpal/Microsoft.CmdPal.UI/Dock/DockWindow.xaml.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockWindow.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockWindow.xaml.cs index 7933134191..f51e83790d 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockWindow.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Dock/DockWindow.xaml.cs @@ -5,6 +5,7 @@ using System.Runtime.InteropServices; using CommunityToolkit.Mvvm.Messaging; using ManagedCommon; +using Microsoft.CmdPal.UI.Helpers; using Microsoft.CmdPal.UI.ViewModels; using Microsoft.CmdPal.UI.ViewModels.Dock; using Microsoft.CmdPal.UI.ViewModels.Messages; @@ -26,6 +27,7 @@ using Windows.Win32.UI.WindowsAndMessaging; using WinRT; using WinRT.Interop; using WinUIEx; +using WindowExtensions = Microsoft.CmdPal.UI.Helpers.WindowExtensions; namespace Microsoft.CmdPal.UI.Dock; @@ -45,6 +47,7 @@ public sealed partial class DockWindow : WindowEx, private readonly IThemeService _themeService; private readonly DockWindowViewModel _windowViewModel; + private readonly HiddenOwnerWindowBehavior _hiddenOwnerWindowBehavior = new(); private HWND _hwnd = HWND.Null; private APPBARDATA _appBarData; @@ -80,7 +83,7 @@ public sealed partial class DockWindow : WindowEx, Root.Children.Add(_dock); ExtendsContentIntoTitleBar = true; AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Collapsed; - AppWindow.IsShownInSwitchers = false; + _hiddenOwnerWindowBehavior.ShowInTaskbar(this, false); if (AppWindow.Presenter is OverlappedPresenter overlappedPresenter) { overlappedPresenter.SetBorderAndTitleBar(false, false);