From b9f013e58b67d869cf910e2d0e6fdcd334ae82f3 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 27 Mar 2025 01:14:13 +0900 Subject: [PATCH 1/8] Fix Clock/Search Icon show logic --- Flow.Launcher/MainWindow.xaml.cs | 38 ++++++------- Flow.Launcher/ViewModel/MainViewModel.cs | 69 +++++++++++++++++++----- 2 files changed, 74 insertions(+), 33 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 136440a6547..068d22a65e4 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Diagnostics; using System.Linq; using System.Media; using System.Threading.Tasks; @@ -58,7 +59,6 @@ public partial class MainWindow : IDisposable // Window Animation private const double DefaultRightMargin = 66; //* this value from base.xaml - private bool _animating; private bool _isClockPanelAnimating = false; // IDisposable @@ -234,7 +234,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _) // Detect History.Visibility changes DependencyPropertyDescriptor - .FromProperty(VisibilityProperty, typeof(StackPanel)) // History는 StackPanel이라고 가정 + .FromProperty(VisibilityProperty, typeof(StackPanel)) .AddValueChanged(History, (s, e) => UpdateClockPanelVisibility()); } @@ -269,7 +269,6 @@ private void OnClosed(object sender, EventArgs e) private void OnLocationChanged(object sender, EventArgs e) { - if (_animating) return; if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation) { @@ -592,7 +591,7 @@ private void UpdateNotifyIconText() private void UpdatePosition(bool force) { - if (_animating && !force) + if (!force) { return; } @@ -768,18 +767,20 @@ private void InitProgressbarAnimation() _viewModel.ProgressBarVisibility = Visibility.Hidden; } - private void WindowAnimation() + public void WindowAnimation() { - if (_animating) - return; - _isArrowKeyPressed = true; - _animating = true; UpdatePosition(false); - - ClockPanel.Opacity = 0; - SearchIcon.Opacity = 0; - + if(_settings.UseAnimation) + { + ClockPanel.Opacity = 0; + SearchIcon.Opacity = 0; + } + else + { + ClockPanel.Opacity = 1; + SearchIcon.Opacity = 1; + } var clocksb = new Storyboard(); var iconsb = new Storyboard(); CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut }; @@ -848,16 +849,11 @@ private void WindowAnimation() clocksb.Children.Add(ClockOpacity); iconsb.Children.Add(IconMotion); iconsb.Children.Add(IconOpacity); - - clocksb.Completed += (_, _) => _animating = false; + _settings.WindowLeft = Left; _isArrowKeyPressed = false; - - if (QueryTextBox.Text.Length == 0) - { - clocksb.Begin(ClockPanel); - } - + + clocksb.Begin(ClockPanel); iconsb.Begin(SearchIcon); } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 258ba3abf57..8d974d3f111 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.Windows.Input; using System.Linq; @@ -1437,11 +1438,43 @@ public void Show() { // 📌 Remove DWM Cloak (Make the window visible normally) Win32Helper.DWMSetCloakForWindow(mainWindow, false); + + //Clock and SearchIcon hide when show situation + if(Settings.UseAnimation) + { + mainWindow.ClockPanel.Opacity = 0; + mainWindow.SearchIcon.Opacity = 0; + } + else + { + mainWindow.ClockPanel.Opacity = 1; + mainWindow.SearchIcon.Opacity = 1; + } + if (mainWindow.QueryTextBox.Text.Length != 0) + { + mainWindow.ClockPanel.Visibility = Visibility.Collapsed; + } + else + { + mainWindow.ClockPanel.Visibility = Visibility.Visible; + } + if (PluginIconSource != null) + { + mainWindow.SearchIcon.Opacity = 0; + } + else + { + SearchIconVisibility = Visibility.Visible; + } // 📌 Restore UI elements - mainWindow.ClockPanel.Visibility = Visibility.Visible; //mainWindow.SearchIcon.Visibility = Visibility.Visible; - SearchIconVisibility = Visibility.Visible; + if (Settings.UseAnimation) + { + Application.Current.Dispatcher.BeginInvoke(() => + mainWindow.WindowAnimation()); + Debug.WriteLine("Call Animation"); + } } // Update WPF properties @@ -1474,15 +1507,19 @@ public async void Hide() } // 📌 Immediately apply text reset + force UI update - if (Settings.LastQueryMode == LastQueryMode.Empty) + /*if (Settings.LastQueryMode == LastQueryMode.Empty) { ChangeQueryText(string.Empty); await Task.Delay(1); // Wait for one frame to ensure UI reflects changes Application.Current.Dispatcher.Invoke(Application.Current.MainWindow.UpdateLayout); // Force UI update - } + }*/ switch (Settings.LastQueryMode) { + case LastQueryMode.Empty: + ChangeQueryText(string.Empty); + await Task.Delay(1); + break; case LastQueryMode.Preserved: case LastQueryMode.Selected: LastQuerySelected = (Settings.LastQueryMode == LastQueryMode.Preserved); @@ -1504,18 +1541,26 @@ public async void Hide() { // 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden Application.Current.Dispatcher.Invoke(() => + { + + }, DispatcherPriority.Render); + if(Settings.UseAnimation) { mainWindow.ClockPanel.Opacity = 0; mainWindow.SearchIcon.Opacity = 0; - mainWindow.ClockPanel.Visibility = Visibility.Hidden; - //mainWindow.SearchIcon.Visibility = Visibility.Hidden; - SearchIconVisibility = Visibility.Hidden; - - // Force UI update - mainWindow.ClockPanel.UpdateLayout(); - mainWindow.SearchIcon.UpdateLayout(); - }, DispatcherPriority.Render); + } + else + { + mainWindow.ClockPanel.Opacity = 1; + mainWindow.SearchIcon.Opacity = 1; + } + mainWindow.ClockPanel.Visibility = Visibility.Hidden; + //mainWindow.SearchIcon.Visibility = Visibility.Hidden; + SearchIconVisibility = Visibility.Hidden; + // Force UI update + mainWindow.ClockPanel.UpdateLayout(); + mainWindow.SearchIcon.UpdateLayout(); // 📌 Apply DWM Cloak (Completely hide the window) Win32Helper.DWMSetCloakForWindow(mainWindow, true); } From 6e2c56b1a9b3080c7aa845c085d54731f5fb61ba Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 27 Mar 2025 01:33:19 +0900 Subject: [PATCH 2/8] Cleaup Code --- Flow.Launcher/ViewModel/MainViewModel.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 8d974d3f111..72c15faef75 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1473,7 +1473,6 @@ public void Show() { Application.Current.Dispatcher.BeginInvoke(() => mainWindow.WindowAnimation()); - Debug.WriteLine("Call Animation"); } } @@ -1540,10 +1539,6 @@ public async void Hide() if (Application.Current.MainWindow is MainWindow mainWindow) { // 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden - Application.Current.Dispatcher.Invoke(() => - { - - }, DispatcherPriority.Render); if(Settings.UseAnimation) { mainWindow.ClockPanel.Opacity = 0; @@ -1555,7 +1550,6 @@ public async void Hide() mainWindow.SearchIcon.Opacity = 1; } mainWindow.ClockPanel.Visibility = Visibility.Hidden; - //mainWindow.SearchIcon.Visibility = Visibility.Hidden; SearchIconVisibility = Visibility.Hidden; // Force UI update From efef28cb264cf12134eb1f43913c5dd79d0b592c Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 27 Mar 2025 01:51:31 +0900 Subject: [PATCH 3/8] Add Small settingwindow fix for high DPI --- Flow.Launcher/SettingWindow.xaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index a81d9e0d108..e9477ef72b0 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -18,6 +18,8 @@ Loaded="OnLoaded" MouseDown="window_MouseDown" ResizeMode="CanResize" + SnapsToDevicePixels="True" + UseLayoutRounding="True" StateChanged="Window_StateChanged" Top="{Binding SettingWindowTop, Mode=TwoWay}" WindowStartupLocation="Manual" From 273ebc690e87dcb3805b3d35fda2c8270e8f7a62 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 27 Mar 2025 02:44:28 +0900 Subject: [PATCH 4/8] Add Color key --- Flow.Launcher/Resources/Dark.xaml | 2 ++ Flow.Launcher/Resources/Light.xaml | 1 + 2 files changed, 3 insertions(+) diff --git a/Flow.Launcher/Resources/Dark.xaml b/Flow.Launcher/Resources/Dark.xaml index 25cc8e878e3..f1ebba080a2 100644 --- a/Flow.Launcher/Resources/Dark.xaml +++ b/Flow.Launcher/Resources/Dark.xaml @@ -115,6 +115,8 @@ + + diff --git a/Flow.Launcher/Resources/Light.xaml b/Flow.Launcher/Resources/Light.xaml index b9f65ce9650..12b35971d20 100644 --- a/Flow.Launcher/Resources/Light.xaml +++ b/Flow.Launcher/Resources/Light.xaml @@ -107,6 +107,7 @@ + From ebf9da2c6185bc229c380b294f78d0fda7ba45c3 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 27 Mar 2025 13:51:01 +0900 Subject: [PATCH 5/8] Adjust TitleBar Icon in Settingwindow --- Flow.Launcher/SettingWindow.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index e9477ef72b0..6d629de6329 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -56,6 +56,7 @@ Width="16" Height="16" Margin="10 4 4 4" + RenderOptions.BitmapScalingMode="HighQuality" Source="/Images/app.png" /> Date: Thu, 27 Mar 2025 13:22:10 +0800 Subject: [PATCH 6/8] Code quality & Fix position update issue --- Flow.Launcher/MainWindow.xaml.cs | 46 +++++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 068d22a65e4..6ddee16c2d8 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1,6 +1,5 @@ using System; using System.ComponentModel; -using System.Diagnostics; using System.Linq; using System.Media; using System.Threading.Tasks; @@ -76,7 +75,7 @@ public MainWindow() DataContext = _viewModel; InitializeComponent(); - UpdatePosition(true); + UpdatePosition(); InitSoundEffects(); DataObject.AddPastingHandler(QueryTextBox, QueryTextBox_OnPaste); @@ -112,7 +111,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _) } // Hide window if need - UpdatePosition(true); + UpdatePosition(); if (_settings.HideOnStartup) { _viewModel.Hide(); @@ -139,7 +138,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _) InitProgressbarAnimation(); // Force update position - UpdatePosition(true); + UpdatePosition(); // Refresh frame await Ioc.Default.GetRequiredService().RefreshFrameAsync(); @@ -167,7 +166,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _) SoundPlay(); } - UpdatePosition(false); + UpdatePosition(); _viewModel.ResetPreview(); Activate(); QueryTextBox.Focus(); @@ -269,7 +268,6 @@ private void OnClosed(object sender, EventArgs e) private void OnLocationChanged(object sender, EventArgs e) { - if (_settings.SearchWindowScreen == SearchWindowScreens.RememberLastLaunchLocation) { _settings.WindowLeft = Left; @@ -281,9 +279,11 @@ private async void OnDeactivated(object sender, EventArgs e) { _settings.WindowLeft = Left; _settings.WindowTop = Top; + ClockPanel.Opacity = 0; SearchIcon.Opacity = 0; - //This condition stops extra hide call when animator is on, + + // This condition stops extra hide call when animator is on, // which causes the toggling to occasional hide instead of show. if (_viewModel.MainWindowVisibilityStatus) { @@ -291,7 +291,6 @@ private async void OnDeactivated(object sender, EventArgs e) // This also stops the mainwindow from flickering occasionally after Settings window is opened // and always after Settings window is closed. if (_settings.UseAnimation) - await Task.Delay(100); if (_settings.HideWhenDeactivated && !_viewModel.ExternalPreviewVisible) @@ -589,13 +588,8 @@ private void UpdateNotifyIconText() #region Window Position - private void UpdatePosition(bool force) + private void UpdatePosition() { - if (!force) - { - return; - } - // Initialize call twice to work around multi-display alignment issue- https://github.com/Flow-Launcher/Flow.Launcher/issues/2910 InitializePosition(); InitializePosition(); @@ -770,20 +764,16 @@ private void InitProgressbarAnimation() public void WindowAnimation() { _isArrowKeyPressed = true; - UpdatePosition(false); - if(_settings.UseAnimation) - { - ClockPanel.Opacity = 0; - SearchIcon.Opacity = 0; - } - else - { - ClockPanel.Opacity = 1; - SearchIcon.Opacity = 1; - } + + UpdatePosition(); + + var opacity = _settings.UseAnimation ? 0.0 : 1.0; + ClockPanel.Opacity = opacity; + SearchIcon.Opacity = opacity; + var clocksb = new Storyboard(); var iconsb = new Storyboard(); - CircleEase easing = new CircleEase { EasingMode = EasingMode.EaseInOut }; + var easing = new CircleEase { EasingMode = EasingMode.EaseInOut }; var animationLength = _settings.AnimationSpeed switch { @@ -811,7 +801,7 @@ public void WindowAnimation() FillBehavior = FillBehavior.HoldEnd }; - double TargetIconOpacity = GetOpacityFromStyle(SearchIcon.Style, 1.0); + var TargetIconOpacity = GetOpacityFromStyle(SearchIcon.Style, 1.0); var IconOpacity = new DoubleAnimation { @@ -822,7 +812,7 @@ public void WindowAnimation() FillBehavior = FillBehavior.HoldEnd }; - double rightMargin = GetThicknessFromStyle(ClockPanel.Style, new Thickness(0, 0, DefaultRightMargin, 0)).Right; + var rightMargin = GetThicknessFromStyle(ClockPanel.Style, new Thickness(0, 0, DefaultRightMargin, 0)).Right; var thicknessAnimation = new ThicknessAnimation { From b88057cbe58ef27e2f41022e98ffd37429529702 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 27 Mar 2025 13:22:23 +0800 Subject: [PATCH 7/8] Code quality & Async support for show / hide --- Flow.Launcher/ViewModel/MainViewModel.cs | 136 +++++++++++------------ 1 file changed, 65 insertions(+), 71 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 72c15faef75..c0465b07462 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1,15 +1,14 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; using System.Globalization; -using System.Windows.Input; using System.Linq; using System.Text; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using System.Windows; +using System.Windows.Input; using System.Windows.Media; using System.Windows.Threading; using CommunityToolkit.Mvvm.DependencyInjection; @@ -631,7 +630,15 @@ private void DecreaseMaxResult() /// Force query even when Query Text doesn't change public void ChangeQueryText(string queryText, bool isReQuery = false) { - Application.Current.Dispatcher.Invoke(() => + _ = ChangeQueryTextAsync(queryText, isReQuery); + } + + /// + /// Async version of + /// + private async Task ChangeQueryTextAsync(string queryText, bool isReQuery = false) + { + await Application.Current.Dispatcher.InvokeAsync(async () => { BackToQueryResults(); @@ -645,7 +652,7 @@ public void ChangeQueryText(string queryText, bool isReQuery = false) } else if (isReQuery) { - Query(isReQuery: true); + await QueryAsync(isReQuery: true); } QueryTextCursorMovedToEnd = true; @@ -1017,10 +1024,15 @@ private bool QueryResultsPreviewed() #region Query private void Query(bool isReQuery = false) + { + _ = QueryAsync(isReQuery); + } + + private async Task QueryAsync(bool isReQuery = false) { if (QueryResultsSelected()) { - _ = QueryResultsAsync(isReQuery); + await QueryResultsAsync(isReQuery); } else if (ContextMenuSelected()) { @@ -1054,10 +1066,10 @@ private void QueryContextMenu() ( r => { - var match = StringMatcher.FuzzySearch(query, r.Title); + var match = App.API.FuzzySearch(query, r.Title); if (!match.IsSearchPrecisionScoreMet()) { - match = StringMatcher.FuzzySearch(query, r.SubTitle); + match = App.API.FuzzySearch(query, r.SubTitle); } if (!match.IsSearchPrecisionScoreMet()) return false; @@ -1099,7 +1111,7 @@ private void QueryHistory() Action = _ => { SelectedResults = Results; - ChangeQueryText(h.Query); + App.API.ChangeQuery(h.Query); return false; } }; @@ -1110,8 +1122,8 @@ private void QueryHistory() { var filtered = results.Where ( - r => StringMatcher.FuzzySearch(query, r.Title).IsSearchPrecisionScoreMet() || - StringMatcher.FuzzySearch(query, r.SubTitle).IsSearchPrecisionScoreMet() + r => App.API.FuzzySearch(query, r.Title).IsSearchPrecisionScoreMet() || + App.API.FuzzySearch(query, r.SubTitle).IsSearchPrecisionScoreMet() ).ToList(); History.AddResults(filtered, id); } @@ -1430,28 +1442,23 @@ public bool ShouldIgnoreHotkeys() #region Public Methods - public void Show() +#pragma warning disable VSTHRD100 // Avoid async void methods + + public async void Show() { - Application.Current.Dispatcher.Invoke(() => + await Application.Current.Dispatcher.InvokeAsync(() => { if (Application.Current.MainWindow is MainWindow mainWindow) { // 📌 Remove DWM Cloak (Make the window visible normally) Win32Helper.DWMSetCloakForWindow(mainWindow, false); - - //Clock and SearchIcon hide when show situation - if(Settings.UseAnimation) - { - mainWindow.ClockPanel.Opacity = 0; - mainWindow.SearchIcon.Opacity = 0; - } - else - { - mainWindow.ClockPanel.Opacity = 1; - mainWindow.SearchIcon.Opacity = 1; - } - if (mainWindow.QueryTextBox.Text.Length != 0) + // Clock and SearchIcon hide when show situation + var opacity = Settings.UseAnimation ? 0.0 : 1.0; + mainWindow.ClockPanel.Opacity = opacity; + mainWindow.SearchIcon.Opacity = opacity; + + if (QueryText.Length != 0) { mainWindow.ClockPanel.Visibility = Visibility.Collapsed; } @@ -1459,6 +1466,7 @@ public void Show() { mainWindow.ClockPanel.Visibility = Visibility.Visible; } + if (PluginIconSource != null) { mainWindow.SearchIcon.Opacity = 0; @@ -1467,30 +1475,28 @@ public void Show() { SearchIconVisibility = Visibility.Visible; } + // 📌 Restore UI elements //mainWindow.SearchIcon.Visibility = Visibility.Visible; if (Settings.UseAnimation) { - Application.Current.Dispatcher.BeginInvoke(() => - mainWindow.WindowAnimation()); + mainWindow.WindowAnimation(); } } + }, DispatcherPriority.Render); - // Update WPF properties - MainWindowVisibility = Visibility.Visible; - MainWindowOpacity = 1; - MainWindowVisibilityStatus = true; - VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true }); + // Update WPF properties + MainWindowVisibility = Visibility.Visible; + MainWindowOpacity = 1; + MainWindowVisibilityStatus = true; + VisibilityChanged?.Invoke(this, new VisibilityChangedEventArgs { IsVisible = true }); - if (StartWithEnglishMode) - { - Win32Helper.SwitchToEnglishKeyboardLayout(true); - } - }); + if (StartWithEnglishMode) + { + Win32Helper.SwitchToEnglishKeyboardLayout(true); + } } -#pragma warning disable VSTHRD100 // Avoid async void methods - public async void Hide() { lastHistoryIndex = 1; @@ -1505,59 +1511,47 @@ public async void Hide() SelectedResults = Results; } - // 📌 Immediately apply text reset + force UI update - /*if (Settings.LastQueryMode == LastQueryMode.Empty) - { - ChangeQueryText(string.Empty); - await Task.Delay(1); // Wait for one frame to ensure UI reflects changes - Application.Current.Dispatcher.Invoke(Application.Current.MainWindow.UpdateLayout); // Force UI update - }*/ - switch (Settings.LastQueryMode) { case LastQueryMode.Empty: - ChangeQueryText(string.Empty); - await Task.Delay(1); + await ChangeQueryTextAsync(string.Empty); break; case LastQueryMode.Preserved: case LastQueryMode.Selected: - LastQuerySelected = (Settings.LastQueryMode == LastQueryMode.Preserved); + LastQuerySelected = Settings.LastQueryMode == LastQueryMode.Preserved; break; - case LastQueryMode.ActionKeywordPreserved: case LastQueryMode.ActionKeywordSelected: var newQuery = _lastQuery.ActionKeyword; + if (!string.IsNullOrEmpty(newQuery)) newQuery += " "; - ChangeQueryText(newQuery); + await ChangeQueryTextAsync(newQuery); if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected) LastQuerySelected = false; break; } - if (Application.Current.MainWindow is MainWindow mainWindow) + await Application.Current.Dispatcher.InvokeAsync(() => { - // 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden - if(Settings.UseAnimation) - { - mainWindow.ClockPanel.Opacity = 0; - mainWindow.SearchIcon.Opacity = 0; - } - else + if (Application.Current.MainWindow is MainWindow mainWindow) { - mainWindow.ClockPanel.Opacity = 1; - mainWindow.SearchIcon.Opacity = 1; + // 📌 Set Opacity of icon and clock to 0 and apply Visibility.Hidden + var opacity = Settings.UseAnimation ? 0.0 : 1.0; + mainWindow.ClockPanel.Opacity = opacity; + mainWindow.SearchIcon.Opacity = opacity; + mainWindow.ClockPanel.Visibility = Visibility.Hidden; + SearchIconVisibility = Visibility.Hidden; + + // Force UI update + mainWindow.ClockPanel.UpdateLayout(); + mainWindow.SearchIcon.UpdateLayout(); + + // 📌 Apply DWM Cloak (Completely hide the window) + Win32Helper.DWMSetCloakForWindow(mainWindow, true); } - mainWindow.ClockPanel.Visibility = Visibility.Hidden; - SearchIconVisibility = Visibility.Hidden; - - // Force UI update - mainWindow.ClockPanel.UpdateLayout(); - mainWindow.SearchIcon.UpdateLayout(); - // 📌 Apply DWM Cloak (Completely hide the window) - Win32Helper.DWMSetCloakForWindow(mainWindow, true); - } + }); if (StartWithEnglishMode) { From 89c3cb1bbcff282c70b90993bbb91ad74a01c77b Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Thu, 27 Mar 2025 14:38:26 +0800 Subject: [PATCH 8/8] Remove redundant animation --- Flow.Launcher/MainWindow.xaml.cs | 2 +- Flow.Launcher/ViewModel/MainViewModel.cs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6ddee16c2d8..25d9c5d2dbe 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -761,7 +761,7 @@ private void InitProgressbarAnimation() _viewModel.ProgressBarVisibility = Visibility.Hidden; } - public void WindowAnimation() + private void WindowAnimation() { _isArrowKeyPressed = true; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index c0465b07462..9b2ad2d40fa 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1478,10 +1478,6 @@ await Application.Current.Dispatcher.InvokeAsync(() => // 📌 Restore UI elements //mainWindow.SearchIcon.Visibility = Visibility.Visible; - if (Settings.UseAnimation) - { - mainWindow.WindowAnimation(); - } } }, DispatcherPriority.Render);