diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index b630a4ecc..34bf4f90e 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -159,7 +159,20 @@ namespace Flow.Launcher.Infrastructure.UserSettings } } - public bool ShowHomePage { get; set; } = true; + private bool _showHomePage { get; set; } = true; + public bool ShowHomePage + { + get => _showHomePage; + set + { + if (_showHomePage != value) + { + _showHomePage = value; + OnPropertyChanged(); + } + } + } + public bool ShowHistoryResultsForHomePage { get; set; } = false; public int MaxHistoryResultsToShowForHomePage { get; set; } = 5; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 546f32cc5..6dcd8d22d 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -277,6 +277,17 @@ namespace Flow.Launcher case nameof(Settings.SettingWindowFont): InitializeContextMenu(); break; + case nameof(Settings.ShowHomePage): + // We should refresh results when these two settings are changed but we cannot do that + // Because the order of the results will change, making the interface look weird + // So we would better refresh results when query text is changed next time + /*case nameof(Settings.ShowHistoryResultsForHomePage): + case nameof(Settings.MaxHistoryResultsToShowForHomePage):*/ + if (string.IsNullOrEmpty(_viewModel.QueryText)) + { + _viewModel.QueryResults(); + } + break; } }; @@ -294,7 +305,10 @@ namespace Flow.Launcher .AddValueChanged(History, (s, e) => UpdateClockPanelVisibility()); // Initialize query state - _viewModel.InitializeQuery(); + if (_settings.ShowHomePage && string.IsNullOrEmpty(_viewModel.QueryText)) + { + _viewModel.QueryResults(); + } } private async void OnClosing(object sender, CancelEventArgs e) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index d850e0f7c..993cc3ba9 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1080,12 +1080,9 @@ namespace Flow.Launcher.ViewModel #region Query - public void InitializeQuery() + public void QueryResults() { - if (Settings.ShowHomePage) - { - _ = QueryResultsAsync(false); - } + _ = QueryResultsAsync(false); } public void Query(bool searchDelay, bool isReQuery = false) diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 092896019..61f6dea33 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -82,6 +82,9 @@ namespace Flow.Launcher.ViewModel { PluginPair.Metadata.HomeDisabled = !value; PluginSettingsObject.HomeDiabled = !value; + // We should refresh results when these two settings are changed but we cannot do that + // Because the order of the results will change, making the interface look weird + // So we would better refresh results when query text is changed next time } }