From b1a46817f01439beab05e1fc59d7ff19fe80d2bd Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 15 Mar 2025 21:58:55 +0800 Subject: [PATCH 01/52] Support search delay --- .../UserSettings/Settings.cs | 3 + Flow.Launcher/Flow.Launcher.csproj | 1 + Flow.Launcher/MainWindow.xaml.cs | 174 +++++++++++++----- Flow.Launcher/ViewModel/MainViewModel.cs | 3 +- 4 files changed, 130 insertions(+), 51 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 93f6db111..66da9f59a 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -275,6 +275,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; + public bool SearchQueryResultsWithDelay { get; set; } = false; + public int SearchInputDelay { get; set; } = 150; + [JsonConverter(typeof(JsonStringEnumConverter))] public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor; diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 1e305d3d9..d4508ad67 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -104,6 +104,7 @@ + diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3616e4c59..2f1b2ce66 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -5,7 +5,6 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media.Animation; using System.Windows.Controls; -using System.Windows.Forms; using Flow.Launcher.Core.Plugin; using Flow.Launcher.Core.Resource; using Flow.Launcher.Helper; @@ -27,6 +26,7 @@ using DataObject = System.Windows.DataObject; using System.Windows.Media; using System.Windows.Interop; using Windows.Win32; +using System.Reactive.Linq; namespace Flow.Launcher { @@ -68,6 +68,7 @@ namespace Flow.Launcher var handle = new WindowInteropHelper(this).Handle; var win = HwndSource.FromHwnd(handle); win.AddHook(WndProc); + SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay); }; } @@ -204,63 +205,63 @@ namespace Flow.Launcher switch (e.PropertyName) { case nameof(MainViewModel.MainWindowVisibilityStatus): - { - Dispatcher.Invoke(() => { - if (_viewModel.MainWindowVisibilityStatus) + Dispatcher.Invoke(() => { - if (_settings.UseSound) + if (_viewModel.MainWindowVisibilityStatus) { - SoundPlay(); - } + if (_settings.UseSound) + { + SoundPlay(); + } - UpdatePosition(); - PreviewReset(); - Activate(); - QueryTextBox.Focus(); - _settings.ActivateTimes++; - if (!_viewModel.LastQuerySelected) + UpdatePosition(); + PreviewReset(); + Activate(); + QueryTextBox.Focus(); + _settings.ActivateTimes++; + if (!_viewModel.LastQuerySelected) + { + QueryTextBox.SelectAll(); + _viewModel.LastQuerySelected = true; + } + + if (_viewModel.ProgressBarVisibility == Visibility.Visible && + isProgressBarStoryboardPaused) + { + _progressBarStoryboard.Begin(ProgressBar, true); + isProgressBarStoryboardPaused = false; + } + + if (_settings.UseAnimation) + WindowAnimator(); + } + else if (!isProgressBarStoryboardPaused) { - QueryTextBox.SelectAll(); - _viewModel.LastQuerySelected = true; + _progressBarStoryboard.Stop(ProgressBar); + isProgressBarStoryboardPaused = true; } - - if (_viewModel.ProgressBarVisibility == Visibility.Visible && - isProgressBarStoryboardPaused) + }); + break; + } + case nameof(MainViewModel.ProgressBarVisibility): + { + Dispatcher.Invoke(() => + { + if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused) + { + _progressBarStoryboard.Stop(ProgressBar); + isProgressBarStoryboardPaused = true; + } + else if (_viewModel.MainWindowVisibilityStatus && + isProgressBarStoryboardPaused) { _progressBarStoryboard.Begin(ProgressBar, true); isProgressBarStoryboardPaused = false; } - - if (_settings.UseAnimation) - WindowAnimator(); - } - else if (!isProgressBarStoryboardPaused) - { - _progressBarStoryboard.Stop(ProgressBar); - isProgressBarStoryboardPaused = true; - } - }); - break; - } - case nameof(MainViewModel.ProgressBarVisibility): - { - Dispatcher.Invoke(() => - { - if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused) - { - _progressBarStoryboard.Stop(ProgressBar); - isProgressBarStoryboardPaused = true; - } - else if (_viewModel.MainWindowVisibilityStatus && - isProgressBarStoryboardPaused) - { - _progressBarStoryboard.Begin(ProgressBar, true); - isProgressBarStoryboardPaused = false; - } - }); - break; - } + }); + break; + } case nameof(MainViewModel.QueryTextCursorMovedToEnd): if (_viewModel.QueryTextCursorMovedToEnd) { @@ -415,10 +416,10 @@ namespace Flow.Launcher { switch (e.Button) { - case MouseButtons.Left: + case System.Windows.Forms.MouseButtons.Left: _viewModel.ToggleFlowLauncher(); break; - case MouseButtons.Right: + case System.Windows.Forms.MouseButtons.Right: contextMenu.IsOpen = true; // Get context menu handle and bring it to the foreground @@ -857,5 +858,78 @@ namespace Flow.Launcher be.UpdateSource(); } } + + #region Search Delay + + // Edited from: https://github.com/microsoft/PowerToys + + private IDisposable _reactiveSubscription; + + private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay) + { + if (_reactiveSubscription != null) + { + _reactiveSubscription.Dispose(); + _reactiveSubscription = null; + } + + QueryTextBox.TextChanged -= QueryTextBox_TextChanged; + + if (showResultsWithDelay) + { + _reactiveSubscription = Observable.FromEventPattern( + conversion => (sender, eventArg) => conversion(sender, eventArg), + add => QueryTextBox.TextChanged += add, + remove => QueryTextBox.TextChanged -= remove) + .Do(@event => ClearAutoCompleteText((TextBox)@event.Sender)) + .Throttle(TimeSpan.FromMilliseconds(_settings.SearchInputDelay)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery((TextBox)@event.Sender))) + .Subscribe(); + } + else + { + QueryTextBox.TextChanged += QueryTextBox_TextChanged; + } + } + + private void QueryTextBox_TextChanged(object sender, TextChangedEventArgs e) + { + var textBox = (TextBox)sender; + ClearAutoCompleteText(textBox); + PerformSearchQuery(textBox); + } + + private void ClearAutoCompleteText(TextBox textBox) + { + var text = textBox.Text; + var autoCompleteText = QueryTextSuggestionBox.Text; + + if (ShouldAutoCompleteTextBeEmpty(text, autoCompleteText)) + { + QueryTextSuggestionBox.Text = string.Empty; + } + } + + private static bool ShouldAutoCompleteTextBeEmpty(string queryText, string autoCompleteText) + { + if (string.IsNullOrEmpty(autoCompleteText)) + { + return false; + } + else + { + // Using Ordinal this is internal + return string.IsNullOrEmpty(queryText) || !autoCompleteText.StartsWith(queryText, StringComparison.Ordinal); + } + } + + private void PerformSearchQuery(TextBox textBox) + { + var text = textBox.Text; + _viewModel.QueryText = text; + _viewModel.Query(); + } + + #endregion } } diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 6b0144a03..373ecdece 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -569,7 +569,6 @@ namespace Flow.Launcher.ViewModel { _queryText = value; OnPropertyChanged(); - Query(); } } @@ -631,6 +630,7 @@ namespace Flow.Launcher.ViewModel { // re-query is done in QueryText's setter method QueryText = queryText; + Query(); // set to false so the subsequent set true triggers // PropertyChanged and MoveQueryTextToEnd is called QueryTextCursorMovedToEnd = false; @@ -695,6 +695,7 @@ namespace Flow.Launcher.ViewModel else { QueryText = string.Empty; + Query(); } } From 3abcebd02b6a0321c963fdd53e6067d30a10c153 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 15 Mar 2025 22:35:51 +0800 Subject: [PATCH 02/52] Add settings ui --- .../UserSettings/Settings.cs | 2 +- Flow.Launcher/Languages/en.xaml | 4 ++++ Flow.Launcher/MainWindow.xaml.cs | 2 +- .../SettingsPaneGeneralViewModel.cs | 16 ++++++++++++++ .../Views/SettingsPaneGeneral.xaml | 22 +++++++++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 66da9f59a..97ee49ef2 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -276,7 +276,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool HideWhenDeactivated { get; set; } = true; public bool SearchQueryResultsWithDelay { get; set; } = false; - public int SearchInputDelay { get; set; } = 150; + public int SearchInputDelay { get; set; } = 120; [JsonConverter(typeof(JsonStringEnumConverter))] public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor; diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index a3f87cd30..454dffd24 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -94,6 +94,10 @@ Flow Launcher search window is hidden in the tray after starting up. Hide tray icon When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window. + Search Delay + Delay for a while to search when typing. This reduces interface jumpiness and result load. + Search Delay Time + Delay time which search results appear when typing is stopped. Default is 120ms. Query Search Precision Changes minimum match score required for results. None diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 2f1b2ce66..9e7b380ed 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -865,7 +865,7 @@ namespace Flow.Launcher private IDisposable _reactiveSubscription; - private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay) + public void SetupSearchTextBoxReactiveness(bool showResultsWithDelay) { if (_reactiveSubscription != null) { diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index de4f158ad..72bdb609b 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -139,6 +139,22 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } } + public bool SearchQueryResultsWithDelay + { + get => Settings.SearchQueryResultsWithDelay; + set + { + Settings.SearchQueryResultsWithDelay = value; + + ((MainWindow)System.Windows.Application.Current.MainWindow).SetupSearchTextBoxReactiveness(value); + } + } + + public IEnumerable SearchInputDelayRange => new List() + { + 30, 60, 90, 120, 150, 180, 210, 240, 270, 300 + }; + public List LastQueryModes { get; } = DropdownDataGeneric.GetValues("LastQuery"); diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml index a80e618e8..986e822e2 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml @@ -172,6 +172,28 @@ OnContent="{DynamicResource enable}" /> + + + + + + + + + + Date: Sat, 15 Mar 2025 22:44:42 +0800 Subject: [PATCH 03/52] Improve strings --- Flow.Launcher/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 454dffd24..2426d90af 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -97,7 +97,7 @@ Search Delay Delay for a while to search when typing. This reduces interface jumpiness and result load. Search Delay Time - Delay time which search results appear when typing is stopped. Default is 120ms. + Delay time after which search results appear when typing is stopped. Default is 120ms. Query Search Precision Changes minimum match score required for results. None From dc3f663947287a9cee926b23991bccc3dc9cf6f1 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 16 Mar 2025 10:25:22 +0800 Subject: [PATCH 04/52] Use property changed to change --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 11 ++++++++++- Flow.Launcher/MainWindow.xaml.cs | 5 ++++- .../ViewModels/SettingsPaneGeneralViewModel.cs | 11 ----------- .../SettingPages/Views/SettingsPaneGeneral.xaml | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 97ee49ef2..df49630c5 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -275,7 +275,16 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; - public bool SearchQueryResultsWithDelay { get; set; } = false; + bool _searchQueryResultsWithDelay { get; set; } + public bool SearchQueryResultsWithDelay + { + get => _searchQueryResultsWithDelay; + set + { + _searchQueryResultsWithDelay = value; + OnPropertyChanged(); + } + } public int SearchInputDelay { get; set; } = 120; [JsonConverter(typeof(JsonStringEnumConverter))] diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 9e7b380ed..a7dc8c1d1 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -297,6 +297,9 @@ namespace Flow.Launcher case nameof(Settings.WindowTop): Top = _settings.WindowTop; break; + case nameof(Settings.SearchQueryResultsWithDelay): + SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay); + break; } }; } @@ -865,7 +868,7 @@ namespace Flow.Launcher private IDisposable _reactiveSubscription; - public void SetupSearchTextBoxReactiveness(bool showResultsWithDelay) + private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay) { if (_reactiveSubscription != null) { diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index 72bdb609b..ced565bc2 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -139,17 +139,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } } - public bool SearchQueryResultsWithDelay - { - get => Settings.SearchQueryResultsWithDelay; - set - { - Settings.SearchQueryResultsWithDelay = value; - - ((MainWindow)System.Windows.Application.Current.MainWindow).SetupSearchTextBoxReactiveness(value); - } - } - public IEnumerable SearchInputDelayRange => new List() { 30, 60, 90, 120, 150, 180, 210, 240, 270, 300 diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml index 986e822e2..ffb58d094 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml @@ -178,7 +178,7 @@ Icon="" Sub="{DynamicResource searchDelayToolTip}"> From e98b1441a4f52b59f116210db706f52205d085ec Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 16 Mar 2025 10:33:06 +0800 Subject: [PATCH 05/52] Improve code quality --- Flow.Launcher/MainWindow.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index a7dc8c1d1..06e19e051 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -68,7 +68,6 @@ namespace Flow.Launcher var handle = new WindowInteropHelper(this).Handle; var win = HwndSource.FromHwnd(handle); win.AddHook(WndProc); - SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay); }; } @@ -196,6 +195,8 @@ namespace Flow.Launcher InitializePosition(); InitializePosition(); PreviewReset(); + // Setup search text box reactiveness + SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay); // since the default main window visibility is visible // so we need set focus during startup QueryTextBox.Focus(); From c114f2d8b56b8b8c34015eab8dbcabedcd915273 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 07:43:34 +0800 Subject: [PATCH 06/52] Fix build issue --- Flow.Launcher/MainWindow.xaml.cs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index b9aeaf380..ce0f6ba6e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -219,28 +219,12 @@ namespace Flow.Launcher _viewModel.LastQuerySelected = true; } - if (_viewModel.ProgressBarVisibility == Visibility.Visible && - isProgressBarStoryboardPaused) - { - _progressBarStoryboard.Begin(ProgressBar, true); - isProgressBarStoryboardPaused = false; - } - if (_settings.UseAnimation) WindowAnimator(); } - else if (!isProgressBarStoryboardPaused) - { - _progressBarStoryboard.Stop(ProgressBar); - isProgressBarStoryboardPaused = true; - } - - if (_settings.UseAnimation) - WindowAnimator(); - } - }); - break; - } + }); + break; + } case nameof(MainViewModel.QueryTextCursorMovedToEnd): if (_viewModel.QueryTextCursorMovedToEnd) { From 8cdb87271ad31e398a5c7bddce406b433c90a1cc Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 08:01:21 +0800 Subject: [PATCH 07/52] Remove auto complete text clear because FL uses binding --- Flow.Launcher/MainWindow.xaml.cs | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index ce0f6ba6e..e901f4c17 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -880,8 +880,7 @@ namespace Flow.Launcher conversion => (sender, eventArg) => conversion(sender, eventArg), add => QueryTextBox.TextChanged += add, remove => QueryTextBox.TextChanged -= remove) - .Do(@event => ClearAutoCompleteText((TextBox)@event.Sender)) - .Throttle(TimeSpan.FromMilliseconds(_settings.SearchInputDelay)) + .Throttle(TimeSpan.FromMilliseconds(_settings.SearchInputDelay * 10)) .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery((TextBox)@event.Sender))) .Subscribe(); } @@ -894,34 +893,9 @@ namespace Flow.Launcher private void QueryTextBox_TextChanged(object sender, TextChangedEventArgs e) { var textBox = (TextBox)sender; - ClearAutoCompleteText(textBox); PerformSearchQuery(textBox); } - private void ClearAutoCompleteText(TextBox textBox) - { - var text = textBox.Text; - var autoCompleteText = QueryTextSuggestionBox.Text; - - if (ShouldAutoCompleteTextBeEmpty(text, autoCompleteText)) - { - QueryTextSuggestionBox.Text = string.Empty; - } - } - - private static bool ShouldAutoCompleteTextBeEmpty(string queryText, string autoCompleteText) - { - if (string.IsNullOrEmpty(autoCompleteText)) - { - return false; - } - else - { - // Using Ordinal this is internal - return string.IsNullOrEmpty(queryText) || !autoCompleteText.StartsWith(queryText, StringComparison.Ordinal); - } - } - private void PerformSearchQuery(TextBox textBox) { var text = textBox.Text; From e98964a01eba96e58f87328b94b2853515fafe80 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 08:01:36 +0800 Subject: [PATCH 08/52] Change to one way binding mode --- Flow.Launcher/MainWindow.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 0720501ca..df681470a 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -243,7 +243,7 @@ PreviewDragOver="OnPreviewDragOver" PreviewKeyUp="QueryTextBox_KeyUp" Style="{DynamicResource QueryBoxStyle}" - Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + Text="{Binding QueryText, Mode=OneWay}" Visibility="Visible" WindowChrome.IsHitTestVisibleInChrome="True"> @@ -377,7 +377,7 @@ Style="{DynamicResource SeparatorStyle}" /> - + From fc4b5c9e6c75661638eef35aa9f922428ad34f68 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 09:06:30 +0800 Subject: [PATCH 09/52] Fix --- Flow.Launcher/MainWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index e901f4c17..d41165c81 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -880,7 +880,7 @@ namespace Flow.Launcher conversion => (sender, eventArg) => conversion(sender, eventArg), add => QueryTextBox.TextChanged += add, remove => QueryTextBox.TextChanged -= remove) - .Throttle(TimeSpan.FromMilliseconds(_settings.SearchInputDelay * 10)) + .Throttle(TimeSpan.FromMilliseconds(_settings.SearchInputDelay)) .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery((TextBox)@event.Sender))) .Subscribe(); } From 5dd9e8d963e8e941b401980010f30c0e9c8af9c6 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 09:11:15 +0800 Subject: [PATCH 10/52] Add plugin search delay settings panel --- .../UserSettings/PluginSettings.cs | 7 ++- .../UserSettings/Settings.cs | 12 +++++ Flow.Launcher.Plugin/PluginMetadata.cs | 2 + Flow.Launcher/Languages/en.xaml | 1 + .../Controls/InstalledPluginDisplay.xaml | 2 + .../Controls/InstalledPluginSearchDelay.xaml | 46 +++++++++++++++++++ .../InstalledPluginSearchDelay.xaml.cs | 11 +++++ .../SettingsPaneGeneralViewModel.cs | 5 +- Flow.Launcher/ViewModel/PluginViewModel.cs | 21 ++++++++- 9 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml create mode 100644 Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml.cs diff --git a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs index 98f4dccda..0ebbdb318 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs @@ -51,6 +51,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } metadata.Disabled = settings.Disabled; metadata.Priority = settings.Priority; + metadata.SearchDelayTime = settings.SearchDelayTime; } else { @@ -59,9 +60,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings ID = metadata.ID, Name = metadata.Name, Version = metadata.Version, - ActionKeywords = metadata.ActionKeywords, + ActionKeywords = metadata.ActionKeywords, Disabled = metadata.Disabled, - Priority = metadata.Priority + Priority = metadata.Priority, + SearchDelayTime = metadata.SearchDelayTime, }; } } @@ -74,6 +76,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string Version { get; set; } public List ActionKeywords { get; set; } // a reference of the action keywords from plugin manager public int Priority { get; set; } + public int SearchDelayTime { get; set; } /// /// Used only to save the state of the plugin in settings diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index df49630c5..82e4468d4 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -287,6 +287,18 @@ namespace Flow.Launcher.Infrastructure.UserSettings } public int SearchInputDelay { get; set; } = 120; + [JsonIgnore] + public List SearchInputDelayRange { get; } = new() + { + 30, 60, 90, 120, 150, 180, 210, 240, 270, 300 + }; + + [JsonIgnore] + public List PluginSearchInputDelayRange { get; } = new() + { + 0, 30, 60, 90, 120, 150 + }; + [JsonConverter(typeof(JsonStringEnumConverter))] public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor; diff --git a/Flow.Launcher.Plugin/PluginMetadata.cs b/Flow.Launcher.Plugin/PluginMetadata.cs index b4e06913e..3cb025c77 100644 --- a/Flow.Launcher.Plugin/PluginMetadata.cs +++ b/Flow.Launcher.Plugin/PluginMetadata.cs @@ -34,6 +34,8 @@ namespace Flow.Launcher.Plugin public List ActionKeywords { get; set; } + public int SearchDelayTime { get; set; } + public string IcoPath { get; set;} public override string ToString() diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 2426d90af..83f0df08d 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -124,6 +124,7 @@ Current action keyword New action keyword Change Action Keywords + Change Seach Delay Time Current Priority New Priority Priority diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml index ed3c29690..e27a15784 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml @@ -95,6 +95,8 @@ + + + + + +  + + + + + + diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml.cs b/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml.cs new file mode 100644 index 000000000..ad9284074 --- /dev/null +++ b/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml.cs @@ -0,0 +1,11 @@ +using System.Windows.Controls; + +namespace Flow.Launcher.Resources.Controls; + +public partial class InstalledPluginSearchDelay : UserControl +{ + public InstalledPluginSearchDelay() + { + InitializeComponent(); + } +} diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index ced565bc2..6e97543db 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -139,10 +139,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } } - public IEnumerable SearchInputDelayRange => new List() - { - 30, 60, 90, 120, 150, 180, 210, 240, 270, 300 - }; + public IEnumerable SearchInputDelayRange => Settings.SearchInputDelayRange; public List LastQueryModes { get; } = DropdownDataGeneric.GetValues("LastQuery"); diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 209a81395..230a76e7a 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -8,6 +8,9 @@ using System.Windows.Controls; using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Core.Resource; using Flow.Launcher.Resources.Controls; +using System.Collections.Generic; +using CommunityToolkit.Mvvm.DependencyInjection; +using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher.ViewModel { @@ -81,6 +84,19 @@ namespace Flow.Launcher.ViewModel } } + public IEnumerable PluginSearchInputDelayRange { get; } = + Ioc.Default.GetRequiredService().PluginSearchInputDelayRange; + + public int PluginSearchDelayTime + { + get => PluginPair.Metadata.SearchDelayTime; + set + { + PluginPair.Metadata.SearchDelayTime = value; + PluginSettingsObject.SearchDelayTime = value; + } + } + private Control _settingControl; private bool _isExpanded; @@ -88,7 +104,10 @@ namespace Flow.Launcher.ViewModel public Control BottomPart1 => IsExpanded ? _bottomPart1 ??= new InstalledPluginDisplayKeyword() : null; private Control _bottomPart2; - public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginDisplayBottomData() : null; + public Control BottomPart2 => IsExpanded ? _bottomPart2 ??= new InstalledPluginSearchDelay() : null; + + private Control _bottomPart3; + public Control BottomPart3 => IsExpanded ? _bottomPart3 ??= new InstalledPluginDisplayBottomData() : null; public bool HasSettingControl => PluginPair.Plugin is ISettingProvider && (PluginPair.Plugin is not JsonRPCPluginBase jsonRPCPluginBase || jsonRPCPluginBase.NeedCreateSettingPanel()); public Control SettingControl From 2c949d6c92774a4e5030b6fdaaeb2132173b82dd Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 09:42:29 +0800 Subject: [PATCH 11/52] Fix setting control --- Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml index e27a15784..66a3ad62e 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml @@ -117,7 +117,7 @@ Content="{Binding SettingControl}" /> - + From 933582b620a6b84c9c6357d3542a36adabe5aaee Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 11:12:58 +0800 Subject: [PATCH 12/52] Change name to search delay & Support plugin search delay --- .../UserSettings/PluginSettings.cs | 6 +- .../UserSettings/Settings.cs | 9 ++- Flow.Launcher.Plugin/PluginMetadata.cs | 2 +- Flow.Launcher/MainWindow.xaml.cs | 29 ++++++-- .../Controls/InstalledPluginSearchDelay.xaml | 4 +- .../SettingsPaneGeneralViewModel.cs | 2 +- .../Views/SettingsPaneGeneral.xaml | 4 +- Flow.Launcher/ViewModel/MainViewModel.cs | 70 +++++++++++++++---- Flow.Launcher/ViewModel/PluginViewModel.cs | 12 ++-- 9 files changed, 98 insertions(+), 40 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs index 0ebbdb318..7e9e22063 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs @@ -51,7 +51,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } metadata.Disabled = settings.Disabled; metadata.Priority = settings.Priority; - metadata.SearchDelayTime = settings.SearchDelayTime; + metadata.SearchDelay = settings.SearchDelay; } else { @@ -63,7 +63,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings ActionKeywords = metadata.ActionKeywords, Disabled = metadata.Disabled, Priority = metadata.Priority, - SearchDelayTime = metadata.SearchDelayTime, + SearchDelay = metadata.SearchDelay, }; } } @@ -76,7 +76,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string Version { get; set; } public List ActionKeywords { get; set; } // a reference of the action keywords from plugin manager public int Priority { get; set; } - public int SearchDelayTime { get; set; } + public int SearchDelay { get; set; } /// /// Used only to save the state of the plugin in settings diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 82e4468d4..3de2bdb61 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -285,16 +285,19 @@ namespace Flow.Launcher.Infrastructure.UserSettings OnPropertyChanged(); } } - public int SearchInputDelay { get; set; } = 120; + public int SearchDelay { get; set; } = 120; + + // TODO: Remove debug codes. + public const int SearchDelayInterval = 30 * 60; [JsonIgnore] - public List SearchInputDelayRange { get; } = new() + public List SearchDelayRange { get; } = new() { 30, 60, 90, 120, 150, 180, 210, 240, 270, 300 }; [JsonIgnore] - public List PluginSearchInputDelayRange { get; } = new() + public List PluginSearchDelayRange { get; } = new() { 0, 30, 60, 90, 120, 150 }; diff --git a/Flow.Launcher.Plugin/PluginMetadata.cs b/Flow.Launcher.Plugin/PluginMetadata.cs index 3cb025c77..5300c2550 100644 --- a/Flow.Launcher.Plugin/PluginMetadata.cs +++ b/Flow.Launcher.Plugin/PluginMetadata.cs @@ -34,7 +34,7 @@ namespace Flow.Launcher.Plugin public List ActionKeywords { get; set; } - public int SearchDelayTime { get; set; } + public int SearchDelay { get; set; } public string IcoPath { get; set;} diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index d41165c81..a615bfa2f 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -880,8 +880,18 @@ namespace Flow.Launcher conversion => (sender, eventArg) => conversion(sender, eventArg), add => QueryTextBox.TextChanged += add, remove => QueryTextBox.TextChanged -= remove) - .Throttle(TimeSpan.FromMilliseconds(_settings.SearchInputDelay)) - .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery((TextBox)@event.Sender))) + .Throttle(TimeSpan.FromMilliseconds(_settings.SearchDelay * 10)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery(0, (TextBox)@event.Sender))) + .Throttle(TimeSpan.FromMilliseconds(Settings.SearchDelayInterval)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery(30, (TextBox)@event.Sender))) + .Throttle(TimeSpan.FromMilliseconds(Settings.SearchDelayInterval)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery(60, (TextBox)@event.Sender))) + .Throttle(TimeSpan.FromMilliseconds(Settings.SearchDelayInterval)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery(90, (TextBox)@event.Sender))) + .Throttle(TimeSpan.FromMilliseconds(Settings.SearchDelayInterval)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery(120, (TextBox)@event.Sender))) + .Throttle(TimeSpan.FromMilliseconds(Settings.SearchDelayInterval)) + .Do(@event => Dispatcher.Invoke(() => PerformSearchQuery(150, (TextBox)@event.Sender))) .Subscribe(); } else @@ -893,14 +903,19 @@ namespace Flow.Launcher private void QueryTextBox_TextChanged(object sender, TextChangedEventArgs e) { var textBox = (TextBox)sender; - PerformSearchQuery(textBox); + PerformSearchQuery(null, textBox); } - private void PerformSearchQuery(TextBox textBox) + // If delayInputTime is null, we will query plugins with all plugin search delay times + private void PerformSearchQuery(int? searchDelay, TextBox textBox) { - var text = textBox.Text; - _viewModel.QueryText = text; - _viewModel.Query(); + // Only update query text when search delay is null or 0 + if (searchDelay.GetValueOrDefault(0) == 0) + { + var text = textBox.Text; + _viewModel.QueryText = text; + } + _viewModel.Query(searchDelay); } #endregion diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml index 8d69c08d9..80fd7525b 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml @@ -38,8 +38,8 @@ Cursor="Hand" DockPanel.Dock="Right" FontWeight="Bold" - ItemsSource="{Binding PluginSearchInputDelayRange}" - SelectedItem="{Binding PluginSearchDelayTime}" + ItemsSource="{Binding PluginSearchDelayRange}" + SelectedItem="{Binding PluginSearchDelay}" ToolTip="{DynamicResource pluginSearchDelayTooltip}" /> diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index 6e97543db..d8fe8bb50 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -139,7 +139,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel } } - public IEnumerable SearchInputDelayRange => Settings.SearchInputDelayRange; + public IEnumerable SearchDelayRange => Settings.SearchDelayRange; public List LastQueryModes { get; } = DropdownDataGeneric.GetValues("LastQuery"); diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml index ffb58d094..bde74c653 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml @@ -189,8 +189,8 @@ Sub="{DynamicResource searchDelayTimeToolTip}"> + ItemsSource="{Binding SearchDelayRange}" + SelectedItem="{Binding Settings.SearchDelay}" /> diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 373ecdece..c5658516a 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -274,14 +274,14 @@ namespace Flow.Launcher.ViewModel { if (SelectedIsFromQueryResults()) { - QueryResults(isReQuery: true); + QueryResults(null, isReQuery: true); } } public void ReQuery(bool reselect) { BackToQueryResults(); - QueryResults(isReQuery: true, reSelect: reselect); + QueryResults(null, isReQuery: true, reSelect: reselect); } [RelayCommand] @@ -630,14 +630,14 @@ namespace Flow.Launcher.ViewModel { // re-query is done in QueryText's setter method QueryText = queryText; - Query(); + Query(null); // set to false so the subsequent set true triggers // PropertyChanged and MoveQueryTextToEnd is called QueryTextCursorMovedToEnd = false; } else if (isReQuery) { - Query(isReQuery: true); + Query(null, isReQuery: true); } QueryTextCursorMovedToEnd = true; @@ -690,12 +690,12 @@ namespace Flow.Launcher.ViewModel // http://stackoverflow.com/posts/25895769/revisions if (string.IsNullOrEmpty(QueryText)) { - Query(); + Query(null); } else { QueryText = string.Empty; - Query(); + Query(null); } } @@ -979,19 +979,27 @@ namespace Flow.Launcher.ViewModel #region Query - public void Query(bool isReQuery = false) + public void Query(int? searchDelay, bool isReQuery = false) { if (SelectedIsFromQueryResults()) { - QueryResults(isReQuery); + QueryResults(searchDelay, isReQuery); } else if (ContextMenuSelected()) { - QueryContextMenu(); + // Only query history when search delay is null or 0 + if (searchDelay.GetValueOrDefault(0) == 0) + { + QueryContextMenu(); + } } else if (HistorySelected()) { - QueryHistory(); + // Only query history when search delay is null or 0 + if (searchDelay.GetValueOrDefault(0) == 0) + { + QueryHistory(); + } } } @@ -1081,7 +1089,7 @@ namespace Flow.Launcher.ViewModel private readonly IReadOnlyList _emptyResult = new List(); - private async void QueryResults(bool isReQuery = false, bool reSelect = true) + private async void QueryResults(int? searchDelay, bool isReQuery = false, bool reSelect = true) { _updateSource?.Cancel(); @@ -1157,12 +1165,44 @@ namespace Flow.Launcher.ViewModel // plugins is ICollection, meaning LINQ will get the Count and preallocate Array - var tasks = plugins.Select(plugin => plugin.Metadata.Disabled switch + Task[] tasks; + if (searchDelay.HasValue) { - false => QueryTask(plugin, reSelect), - true => Task.CompletedTask - }).ToArray(); + var searchDelayValue = searchDelay.Value; + tasks = plugins.Select(plugin => (plugin.Metadata.Disabled || plugin.Metadata.SearchDelay != searchDelayValue) switch + { + false => QueryTask(plugin, reSelect), + true => Task.CompletedTask + }).ToArray(); + // TODO: Remove debug codes. + System.Diagnostics.Debug.WriteLine($"Querying {searchDelayValue}ms"); + foreach (var plugin in plugins) + { + if (!(plugin.Metadata.Disabled || plugin.Metadata.SearchDelay != searchDelayValue)) + { + System.Diagnostics.Debug.WriteLine($"Querying {plugin.Metadata.Name}"); + } + } + } + else + { + tasks = plugins.Select(plugin => plugin.Metadata.Disabled switch + { + false => QueryTask(plugin, reSelect), + true => Task.CompletedTask + }).ToArray(); + + // TODO: Remove debug codes. + System.Diagnostics.Debug.WriteLine($"Querying null ms"); + foreach (var plugin in plugins) + { + if (!plugin.Metadata.Disabled) + { + System.Diagnostics.Debug.WriteLine($"Querying {plugin.Metadata.Name}"); + } + } + } try { diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 230a76e7a..e44443ac0 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -84,16 +84,16 @@ namespace Flow.Launcher.ViewModel } } - public IEnumerable PluginSearchInputDelayRange { get; } = - Ioc.Default.GetRequiredService().PluginSearchInputDelayRange; + public IEnumerable PluginSearchDelayRange { get; } = + Ioc.Default.GetRequiredService().PluginSearchDelayRange; - public int PluginSearchDelayTime + public int PluginSearchDelay { - get => PluginPair.Metadata.SearchDelayTime; + get => PluginPair.Metadata.SearchDelay; set { - PluginPair.Metadata.SearchDelayTime = value; - PluginSettingsObject.SearchDelayTime = value; + PluginPair.Metadata.SearchDelay = value; + PluginSettingsObject.SearchDelay = value; } } From 2738636a4cc43c95c8b73739961d813b92317ea7 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 18 Mar 2025 12:35:14 +0800 Subject: [PATCH 13/52] Improve debug codes --- Flow.Launcher/ViewModel/MainViewModel.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index c5658516a..5a627b269 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1091,6 +1091,8 @@ namespace Flow.Launcher.ViewModel private async void QueryResults(int? searchDelay, bool isReQuery = false, bool reSelect = true) { + System.Diagnostics.Debug.WriteLine("!!!QueryResults"); + _updateSource?.Cancel(); var query = ConstructQuery(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts); @@ -1176,14 +1178,15 @@ namespace Flow.Launcher.ViewModel }).ToArray(); // TODO: Remove debug codes. - System.Diagnostics.Debug.WriteLine($"Querying {searchDelayValue}ms"); + System.Diagnostics.Debug.Write($"!!!{query.RawQuery} Querying {searchDelayValue}ms"); foreach (var plugin in plugins) { if (!(plugin.Metadata.Disabled || plugin.Metadata.SearchDelay != searchDelayValue)) { - System.Diagnostics.Debug.WriteLine($"Querying {plugin.Metadata.Name}"); + System.Diagnostics.Debug.Write($"{plugin.Metadata.Name}"); } } + System.Diagnostics.Debug.Write("\n"); } else { @@ -1194,14 +1197,15 @@ namespace Flow.Launcher.ViewModel }).ToArray(); // TODO: Remove debug codes. - System.Diagnostics.Debug.WriteLine($"Querying null ms"); + System.Diagnostics.Debug.Write($"!!!{query.RawQuery} Querying null ms"); foreach (var plugin in plugins) { if (!plugin.Metadata.Disabled) { - System.Diagnostics.Debug.WriteLine($"Querying {plugin.Metadata.Name}"); + System.Diagnostics.Debug.Write($"{plugin.Metadata.Name}"); } } + System.Diagnostics.Debug.Write("\n"); } try From dc92f6a2719d0bf2557c999425694f62e062a72b Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Mar 2025 07:57:13 +0800 Subject: [PATCH 14/52] Fix build issue --- Flow.Launcher/ViewModel/MainViewModel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 9f2ccc679..91be72483 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1147,7 +1147,7 @@ namespace Flow.Launcher.ViewModel var searchDelayValue = searchDelay.Value; tasks = plugins.Select(plugin => (plugin.Metadata.Disabled || plugin.Metadata.SearchDelay != searchDelayValue) switch { - false => QueryTask(plugin, reSelect), + false => QueryTaskAsync(plugin, reSelect), true => Task.CompletedTask }).ToArray(); @@ -1166,7 +1166,7 @@ namespace Flow.Launcher.ViewModel { tasks = plugins.Select(plugin => plugin.Metadata.Disabled switch { - false => QueryTask(plugin, reSelect), + false => QueryTaskAsync(plugin, reSelect), true => Task.CompletedTask }).ToArray(); From 102636f3574b9acbbfc4de3034e2b4a9587785ee Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Mar 2025 07:57:27 +0800 Subject: [PATCH 15/52] Improve code quality --- Flow.Launcher/MainWindow.xaml.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 82e7046cf..43274e496 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using System.Linq; using System.Media; +using System.Reactive.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -10,7 +11,6 @@ using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Controls; using System.Windows.Shapes; using System.Windows.Threading; using CommunityToolkit.Mvvm.DependencyInjection; @@ -22,14 +22,8 @@ using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin.SharedCommands; using Flow.Launcher.ViewModel; using ModernWpf.Controls; -using Key = System.Windows.Input.Key; -using System.Media; using DataObject = System.Windows.DataObject; -using System.Windows.Media; -using System.Windows.Interop; -using Windows.Win32; -using System.Reactive.Linq; -using System.Windows.Shapes; +using Key = System.Windows.Input.Key; using MouseButtons = System.Windows.Forms.MouseButtons; using NotifyIcon = System.Windows.Forms.NotifyIcon; using Screen = System.Windows.Forms.Screen; @@ -539,10 +533,10 @@ namespace Flow.Launcher { switch (e.Button) { - case System.Windows.Forms.MouseButtons.Left: + case MouseButtons.Left: _viewModel.ToggleFlowLauncher(); break; - case System.Windows.Forms.MouseButtons.Right: + case MouseButtons.Right: contextMenu.IsOpen = true; // Get context menu handle and bring it to the foreground From 8c387d0d94b7db090013ceef679c6a0e518e3383 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 21 Mar 2025 07:58:00 +0800 Subject: [PATCH 16/52] Improve code quality & Add oneway bind mode --- .../Controls/InstalledPluginDisplay.xaml | 41 ++++++++++--------- Flow.Launcher/ViewModel/PluginViewModel.cs | 36 +++++++++------- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml index 66a3ad62e..b19c668e0 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml @@ -1,14 +1,16 @@ - + + Source="{Binding Image, Mode=OneWay, IsAsync=True}" /> - + - + @@ -98,9 +101,9 @@ + BorderThickness="0 1 0 0"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs b/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs new file mode 100644 index 000000000..5889a1280 --- /dev/null +++ b/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs @@ -0,0 +1,55 @@ +using System.Linq; +using System.Windows; +using Flow.Launcher.Plugin; +using Flow.Launcher.SettingPages.ViewModels; +using Flow.Launcher.ViewModel; +using static Flow.Launcher.SettingPages.ViewModels.SettingsPaneGeneralViewModel; + +namespace Flow.Launcher; + +public partial class SearchDelaySpeedWindow : Window +{ + private readonly PluginViewModel _pluginViewModel; + + public SearchDelaySpeedWindow(PluginViewModel pluginViewModel) + { + InitializeComponent(); + _pluginViewModel = pluginViewModel; + } + + private void SearchDelaySpeed_OnLoaded(object sender, RoutedEventArgs e) + { + tbOldSearchDelaySpeed.Text = _pluginViewModel.SearchDelaySpeedText; + var searchDelaySpeeds = DropdownDataGeneric.GetValues("SearchDelaySpeed"); + SearchDelaySpeedData selected = null; + // Because default value is SearchDelaySpeeds.Slow, we need to get selected value before adding default value + if (_pluginViewModel.PluginSearchDelay != null) + { + selected = searchDelaySpeeds.FirstOrDefault(x => x.Value == _pluginViewModel.PluginSearchDelay); + } + // Add default value to the beginning of the list + // This value should be null + searchDelaySpeeds.Insert(0, new SearchDelaySpeedData { Display = App.API.GetTranslation(PluginViewModel.DefaultLocalizationKey), LocalizationKey = PluginViewModel.DefaultLocalizationKey }); + selected ??= searchDelaySpeeds.FirstOrDefault(); + tbDelay.ItemsSource = searchDelaySpeeds; + tbDelay.SelectedItem = selected; + tbDelay.Focus(); + } + + private void BtnCancel_OnClick(object sender, RoutedEventArgs e) + { + Close(); + } + + private void btnDone_OnClick(object sender, RoutedEventArgs _) + { + // Update search delay speed + var selected = tbDelay.SelectedItem as SearchDelaySpeedData; + SearchDelaySpeeds? changedValue = selected?.LocalizationKey != PluginViewModel.DefaultLocalizationKey ? selected.Value : null; + _pluginViewModel.PluginSearchDelay = changedValue; + + // Update search delay speed text and close window + _pluginViewModel.OnSearchDelaySpeedChanged(); + Close(); + } +} diff --git a/Flow.Launcher/SettingPages/ViewModels/DropdownDataGeneric.cs b/Flow.Launcher/SettingPages/ViewModels/DropdownDataGeneric.cs index 15a814436..c8c119e94 100644 --- a/Flow.Launcher/SettingPages/ViewModels/DropdownDataGeneric.cs +++ b/Flow.Launcher/SettingPages/ViewModels/DropdownDataGeneric.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Flow.Launcher.Core.Resource; using Flow.Launcher.Plugin; namespace Flow.Launcher.SettingPages.ViewModels; @@ -9,7 +8,7 @@ public class DropdownDataGeneric : BaseModel where TValue : Enum { public string Display { get; set; } public TValue Value { get; private init; } - private string LocalizationKey { get; init; } + public string LocalizationKey { get; set; } public static List GetValues(string keyPrefix) where TR : DropdownDataGeneric, new() { @@ -19,7 +18,7 @@ public class DropdownDataGeneric : BaseModel where TValue : Enum foreach (var value in enumValues) { var key = keyPrefix + value; - var display = InternationalizationManager.Instance.GetTranslation(key); + var display = App.API.GetTranslation(key); data.Add(new TR { Display = display, Value = value, LocalizationKey = key }); } @@ -30,7 +29,7 @@ public class DropdownDataGeneric : BaseModel where TValue : Enum { foreach (var item in options) { - item.Display = InternationalizationManager.Instance.GetTranslation(item.LocalizationKey); + item.Display = App.API.GetTranslation(item.LocalizationKey); } } } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs index 4a729b578..909011579 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs @@ -150,7 +150,7 @@ public partial class SettingsPaneGeneralViewModel : BaseModel public SearchDelaySpeedData SearchDelaySpeed { get => SearchDelaySpeeds.FirstOrDefault(x => x.Value == Settings.SearchDelaySpeed) ?? - SearchDelaySpeeds.FirstOrDefault(x => x.Value == Flow.Launcher.Plugin.SearchDelaySpeeds.Medium) ?? + SearchDelaySpeeds.FirstOrDefault(x => x.Value == Plugin.SearchDelaySpeeds.Medium) ?? SearchDelaySpeeds.FirstOrDefault(); set { diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index e63336235..7ca776512 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -13,6 +13,8 @@ namespace Flow.Launcher.ViewModel { public partial class PluginViewModel : BaseModel { + public const string DefaultLocalizationKey = "default"; + private readonly PluginPair _pluginPair; public PluginPair PluginPair { @@ -127,7 +129,7 @@ namespace Flow.Launcher.ViewModel PluginPair.Metadata.AvgQueryTime + "ms"; public string ActionKeywordsText => string.Join(Query.ActionKeywordSeparator, PluginPair.Metadata.ActionKeywords); public int Priority => PluginPair.Metadata.Priority; - public string SearchDelaySpeedText => PluginPair.Metadata.SearchDelaySpeed == null ? App.API.GetTranslation("default") : App.API.GetTranslation($"SearchDelaySpeed{PluginPair.Metadata.SearchDelaySpeed}"); + public string SearchDelaySpeedText => PluginPair.Metadata.SearchDelaySpeed == null ? App.API.GetTranslation(DefaultLocalizationKey) : App.API.GetTranslation($"SearchDelaySpeed{PluginPair.Metadata.SearchDelaySpeed}"); public Infrastructure.UserSettings.Plugin PluginSettingsObject{ get; init; } public void OnActionKeywordsChanged() @@ -135,6 +137,11 @@ namespace Flow.Launcher.ViewModel OnPropertyChanged(nameof(ActionKeywordsText)); } + public void OnSearchDelaySpeedChanged() + { + OnPropertyChanged(nameof(SearchDelaySpeedText)); + } + public void ChangePriority(int newPriority) { PluginPair.Metadata.Priority = newPriority; @@ -180,8 +187,8 @@ namespace Flow.Launcher.ViewModel [RelayCommand] private void SetSearchDelaySpeed() { - /*var searchDelaySpeedWindow = new SearchDelaySpeedWindow(this); - searchDelaySpeedWindow.ShowDialog();*/ + var searchDelaySpeedWindow = new SearchDelaySpeedWindow(this); + searchDelaySpeedWindow.ShowDialog(); } } } From e9c1cffd3304867f24d2cd2f2c609998c75755d3 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 31 Mar 2025 12:58:27 +0800 Subject: [PATCH 45/52] Code quality --- .../UserSettings/Settings.cs | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index ab0a364d2..fed4b667b 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -320,28 +320,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; - bool _searchQueryResultsWithDelay { get; set; } - public bool SearchQueryResultsWithDelay - { - get => _searchQueryResultsWithDelay; - set - { - _searchQueryResultsWithDelay = value; - OnPropertyChanged(); - } - } - - SearchDelaySpeeds searchDelaySpeed { get; set; } = SearchDelaySpeeds.Medium; + public bool SearchQueryResultsWithDelay { get; set; } + [JsonConverter(typeof(JsonStringEnumConverter))] - public SearchDelaySpeeds SearchDelaySpeed - { - get => searchDelaySpeed; - set - { - searchDelaySpeed = value; - OnPropertyChanged(); - } - } + public SearchDelaySpeeds SearchDelaySpeed { get; set; } = SearchDelaySpeeds.Medium; [JsonConverter(typeof(JsonStringEnumConverter))] public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor; From dec1e77b0ce7dd31aab99661b7505d3cf8bf2a7c Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 31 Mar 2025 13:04:41 +0800 Subject: [PATCH 46/52] Improve code comments --- Flow.Launcher/SearchDelaySpeedWindow.xaml.cs | 2 +- Flow.Launcher/ViewModel/MainViewModel.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs b/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs index 5889a1280..cfbde8be2 100644 --- a/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs +++ b/Flow.Launcher/SearchDelaySpeedWindow.xaml.cs @@ -28,7 +28,7 @@ public partial class SearchDelaySpeedWindow : Window selected = searchDelaySpeeds.FirstOrDefault(x => x.Value == _pluginViewModel.PluginSearchDelay); } // Add default value to the beginning of the list - // This value should be null + // When _pluginViewModel.PluginSearchDelay equals null, we will select this searchDelaySpeeds.Insert(0, new SearchDelaySpeedData { Display = App.API.GetTranslation(PluginViewModel.DefaultLocalizationKey), LocalizationKey = PluginViewModel.DefaultLocalizationKey }); selected ??= searchDelaySpeeds.FirstOrDefault(); tbDelay.ItemsSource = searchDelaySpeeds; diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 309cd67bb..f43931192 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -298,7 +298,7 @@ namespace Flow.Launcher.ViewModel { if (QueryResultsSelected()) { - // When we are requiring, we should not delay the query + // When we are re-querying, we should not delay the query _ = QueryResultsAsync(false, isReQuery: true); } } @@ -306,7 +306,7 @@ namespace Flow.Launcher.ViewModel public void ReQuery(bool reselect) { BackToQueryResults(); - // When we are requiring, we should not delay the query + // When we are re-querying, we should not delay the query _ = QueryResultsAsync(false, isReQuery: true, reSelect: reselect); } @@ -660,7 +660,7 @@ namespace Flow.Launcher.ViewModel } else if (isReQuery) { - // When we are requiring, we should not delay the query + // When we are re-querying, we should not delay the query await QueryAsync(false, isReQuery: true); } From c4cd51c3126db130864d40ce05898962526a6d70 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 31 Mar 2025 13:26:09 +0800 Subject: [PATCH 47/52] Change to search delay time --- .../UserSettings/PluginSettings.cs | 12 +++---- .../UserSettings/Settings.cs | 2 +- Flow.Launcher.Plugin/PluginMetadata.cs | 4 +-- Flow.Launcher.Plugin/SearchDelaySpeeds.cs | 32 ----------------- Flow.Launcher.Plugin/SearchDelayTime.cs | 32 +++++++++++++++++ Flow.Launcher/Languages/en.xaml | 26 +++++++------- .../Controls/InstalledPluginSearchDelay.xaml | 8 ++--- Flow.Launcher/SearchDelaySpeedWindow.xaml | 16 ++++----- Flow.Launcher/SearchDelaySpeedWindow.xaml.cs | 36 +++++++++---------- .../SettingsPaneGeneralViewModel.cs | 20 +++++------ .../Views/SettingsPaneGeneral.xaml | 8 ++--- Flow.Launcher/ViewModel/MainViewModel.cs | 13 ++++--- Flow.Launcher/ViewModel/PluginViewModel.cs | 22 ++++++------ .../plugin.json | 2 +- 14 files changed, 115 insertions(+), 118 deletions(-) delete mode 100644 Flow.Launcher.Plugin/SearchDelaySpeeds.cs create mode 100644 Flow.Launcher.Plugin/SearchDelayTime.cs diff --git a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs index d1c047495..da92a3583 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs @@ -51,7 +51,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings settings.Version = metadata.Version; } settings.DefaultActionKeywords = metadata.ActionKeywords; // metadata provides default values - settings.DefaultSearchDelaySpeed = metadata.SearchDelaySpeed; // metadata provides default values + settings.DefaultSearchDelayTime = metadata.SearchDelayTime; // metadata provides default values // update metadata values with settings if (settings.ActionKeywords?.Count > 0) @@ -66,7 +66,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } metadata.Disabled = settings.Disabled; metadata.Priority = settings.Priority; - metadata.SearchDelaySpeed = settings.SearchDelaySpeed; + metadata.SearchDelayTime = settings.SearchDelayTime; } else { @@ -80,8 +80,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings ActionKeywords = metadata.ActionKeywords, // use default value Disabled = metadata.Disabled, Priority = metadata.Priority, - DefaultSearchDelaySpeed = metadata.SearchDelaySpeed, // metadata provides default values - SearchDelaySpeed = metadata.SearchDelaySpeed, // use default value + DefaultSearchDelayTime = metadata.SearchDelayTime, // metadata provides default values + SearchDelayTime = metadata.SearchDelayTime, // use default value }; } } @@ -120,10 +120,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings public int Priority { get; set; } [JsonIgnore] - public SearchDelaySpeeds? DefaultSearchDelaySpeed { get; set; } + public SearchDelayTime? DefaultSearchDelayTime { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public SearchDelaySpeeds? SearchDelaySpeed { get; set; } + public SearchDelayTime? SearchDelayTime { get; set; } /// /// Used only to save the state of the plugin in settings diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index fed4b667b..fcfbe8ca0 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -323,7 +323,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings public bool SearchQueryResultsWithDelay { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] - public SearchDelaySpeeds SearchDelaySpeed { get; set; } = SearchDelaySpeeds.Medium; + public SearchDelayTime SearchDelayTime { get; set; } = SearchDelayTime.Medium; [JsonConverter(typeof(JsonStringEnumConverter))] public SearchWindowScreens SearchWindowScreen { get; set; } = SearchWindowScreens.Cursor; diff --git a/Flow.Launcher.Plugin/PluginMetadata.cs b/Flow.Launcher.Plugin/PluginMetadata.cs index 42b623717..1496765ce 100644 --- a/Flow.Launcher.Plugin/PluginMetadata.cs +++ b/Flow.Launcher.Plugin/PluginMetadata.cs @@ -99,10 +99,10 @@ namespace Flow.Launcher.Plugin public bool HideActionKeywordPanel { get; set; } /// - /// Plugin search delay speed. Null means use default search delay. + /// Plugin search delay time. Null means use default search delay time. /// [JsonConverter(typeof(JsonStringEnumConverter))] - public SearchDelaySpeeds? SearchDelaySpeed { get; set; } = null; + public SearchDelayTime? SearchDelayTime { get; set; } = null; /// /// Plugin icon path. diff --git a/Flow.Launcher.Plugin/SearchDelaySpeeds.cs b/Flow.Launcher.Plugin/SearchDelaySpeeds.cs deleted file mode 100644 index 543f8b3f6..000000000 --- a/Flow.Launcher.Plugin/SearchDelaySpeeds.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Flow.Launcher.Plugin; - -/// -/// Enum for search delay speeds -/// -public enum SearchDelaySpeeds -{ - /// - /// Slow search delay speed. 50ms. - /// - Slow, - - /// - /// Moderately slow search delay speed. 100ms. - /// - ModeratelySlow, - - /// - /// Medium search delay speed. 150ms. Default value. - /// - Medium, - - /// - /// Moderately fast search delay speed. 200ms. - /// - ModeratelyFast, - - /// - /// Fast search delay speed. 250ms. - /// - Fast -} diff --git a/Flow.Launcher.Plugin/SearchDelayTime.cs b/Flow.Launcher.Plugin/SearchDelayTime.cs new file mode 100644 index 000000000..8dae5997e --- /dev/null +++ b/Flow.Launcher.Plugin/SearchDelayTime.cs @@ -0,0 +1,32 @@ +namespace Flow.Launcher.Plugin; + +/// +/// Enum for search delay time +/// +public enum SearchDelayTime +{ + /// + /// Long search delay time. 250ms. + /// + Long, + + /// + /// Moderately long search delay time. 200ms. + /// + ModeratelyLong, + + /// + /// Medium search delay time. 150ms. Default value. + /// + Medium, + + /// + /// Moderately short search delay time. 100ms. + /// + ModeratelyShort, + + /// + /// Short search delay time. 50ms. + /// + Short +} diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index ae930db70..e6a764d48 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -104,13 +104,13 @@ Shadow effect is not allowed while current theme has blur effect enabled Search Delay Delay for a while to search when typing. This reduces interface jumpiness and result load. - Default Search Delay Speed - Plugins default delay time after which search results appear when typing is stopped. Default is medium. - Slow - Moderately slow - Medium - Moderately fast - Fast + Default Search Delay Time + Plugin default delay time after which search results appear when typing is stopped. Default is "Medium". + Long + Moderately long + Medium + Moderately short + Short Search Plugin @@ -127,8 +127,8 @@ Current action keyword New action keyword Change Action Keywords - Plugin seach delay speed - Change Plugin Seach Delay Speed + Plugin seach delay time + Change Plugin Seach Delay Time Current Priority New Priority Priority @@ -366,10 +366,10 @@ Enter the action keywords you like to use to start the plugin and use whitespace to divide them. Use * if you don't want to specify any, and the plugin will be triggered without any action keywords. - Search Delay Speed Setting - Select the search delay speed you like to use for the plugin. Select Default if you don't want to specify any, and the plugin will use default search delay speed. - Current search delay speed - New search delay speed + Search Delay Time Setting + Select the search delay time you like to use for the plugin. Select "{0}" if you don't want to specify any, and the plugin will use default search delay time. + Current search delay time + New search delay time Custom Query Hotkey diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml index bd2f9a7c9..0fd98bfac 100644 --- a/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml +++ b/Flow.Launcher/Resources/Controls/InstalledPluginSearchDelay.xaml @@ -32,18 +32,18 @@ VerticalAlignment="Center" DockPanel.Dock="Left" Style="{DynamicResource SettingTitleLabel}" - Text="{DynamicResource pluginSearchDelaySpeed}" /> + Text="{DynamicResource pluginSearchDelayTime}" />