Skip to content

Commit 2c00b31

Browse files
Improve taskbar visibility management in MainViewModel
Moved taskbar show logic to after keyboard layout switch in Show().Ensures consistent taskbar state when invoking or hiding the app.
1 parent 471a310 commit 2c00b31

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,17 @@ private static string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotk
10041004

10051005
public bool StartWithEnglishMode => Settings.AlwaysStartEn;
10061006

1007+
private bool isOnPrimaryScreen = true;
1008+
public bool IsOnPrimaryScreen
1009+
{
1010+
get => isOnPrimaryScreen;
1011+
set
1012+
{
1013+
isOnPrimaryScreen = value;
1014+
OnPropertyChanged();
1015+
}
1016+
}
1017+
10071018
#endregion
10081019

10091020
#region Preview
@@ -2099,13 +2110,6 @@ public void Show()
20992110
// When application is exiting, we should not show the main window
21002111
if (App.LoadingOrExiting) return;
21012112

2102-
// Show the taskbar if the setting is enabled
2103-
if (Settings.ShowTaskbarWhenInvoked && !_taskbarShownByFlow)
2104-
{
2105-
Win32Helper.ShowTaskbar();
2106-
_taskbarShownByFlow = true;
2107-
}
2108-
21092113
// When application is exiting, the Application.Current will be null
21102114
Application.Current?.Dispatcher.Invoke(() =>
21112115
{
@@ -2143,6 +2147,13 @@ public void Show()
21432147
{
21442148
Win32Helper.SwitchToEnglishKeyboardLayout(true);
21452149
}
2150+
2151+
// Show the taskbar if the setting is enabled
2152+
if (Settings.ShowTaskbarWhenInvoked && !_taskbarShownByFlow)
2153+
{
2154+
Win32Helper.ShowTaskbar(isOnPrimaryScreen);
2155+
_taskbarShownByFlow = true;
2156+
}
21462157
}
21472158

21482159
public async void Hide(bool reset = true)
@@ -2211,9 +2222,10 @@ public async void Hide(bool reset = true)
22112222
Win32Helper.RestorePreviousKeyboardLayout();
22122223
}
22132224

2214-
if (Settings.ShowTaskbarWhenInvoked && _taskbarShownByFlow)
2225+
// Hide the taskbar if the setting is enabled
2226+
if (_taskbarShownByFlow)
22152227
{
2216-
Win32Helper.HideTaskbar();
2228+
Win32Helper.HideTaskbar(isOnPrimaryScreen);
22172229
_taskbarShownByFlow = false;
22182230
}
22192231

0 commit comments

Comments
 (0)