From c5373f6abf29e95bd3452ea3ee1f6e999b796fc4 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 13 Jul 2025 10:51:03 +0800 Subject: [PATCH 1/4] Use one way binding for showing result hotkey --- .../UserSettings/Settings.cs | 16 +++++++++++++++- Flow.Launcher/ResultListBox.xaml | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index d55daf175..1a5367499 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -42,7 +42,21 @@ namespace Flow.Launcher.Infrastructure.UserSettings public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public string ColorScheme { get; set; } = "System"; - public bool ShowOpenResultHotkey { get; set; } = true; + + private bool _showOpenResultHotkey = true; + public bool ShowOpenResultHotkey + { + get => _showOpenResultHotkey; + set + { + if (_showOpenResultHotkey != value) + { + _showOpenResultHotkey = value; + OnPropertyChanged(); + } + } + } + public double WindowSize { get; set; } = 580; public string PreviewHotkey { get; set; } = $"F1"; public string AutoCompleteHotkey { get; set; } = $"{KeyConstant.Ctrl} + Tab"; diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 8cb15400f..9b5235217 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -36,6 +36,7 @@ + @@ -66,7 +67,7 @@ Grid.Column="2" Margin="0 0 10 0" VerticalAlignment="Center" - Visibility="{Binding ShowOpenResultHotkey}"> + Visibility="{Binding Settings.ShowOpenResultHotkey, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"> From ed4fdb7561dc4a5ae25324d9816e437cccb1279f Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 13 Jul 2025 10:55:13 +0800 Subject: [PATCH 2/4] Update result modifiers when OpenResultModifiers is changed --- .../UserSettings/Settings.cs | 16 +++++++++++++++- Flow.Launcher/MainWindow.xaml.cs | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 1a5367499..0e755b4f4 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -40,7 +40,21 @@ namespace Flow.Launcher.Infrastructure.UserSettings } public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; - public string OpenResultModifiers { get; set; } = KeyConstant.Alt; + + private string _openResultModifiers = KeyConstant.Alt; + public string OpenResultModifiers + { + get => _openResultModifiers; + set + { + if (_openResultModifiers != value) + { + _openResultModifiers = value; + OnPropertyChanged(); + } + } + } + public string ColorScheme { get; set; } = "System"; private bool _showOpenResultHotkey = true; diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 0c8fb4d02..900befe72 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -323,6 +323,12 @@ namespace Flow.Launcher case nameof(Settings.ShowAtTopmost): Topmost = _settings.ShowAtTopmost; break; + case nameof(Settings.OpenResultModifiers): + if (_viewModel.QueryResultsSelected() && string.IsNullOrEmpty(_viewModel.QueryText)) + { + _viewModel.QueryResults(); + } + break; } }; From b16cd145c14deeb402fa9d594347dafd3d708462 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 13 Jul 2025 10:59:34 +0800 Subject: [PATCH 3/4] Remove unused property --- Flow.Launcher/ViewModel/ResultViewModel.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index 648ac49bb..df37fef09 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -64,9 +64,6 @@ namespace Flow.Launcher.ViewModel public Settings Settings { get; } - public Visibility ShowOpenResultHotkey => - Settings.ShowOpenResultHotkey ? Visibility.Visible : Visibility.Collapsed; - public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed; public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible; From 67ec700caff12eb129012fa8578163d5afce4a04 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 13 Jul 2025 18:03:14 +0800 Subject: [PATCH 4/4] Use one way binding for modifiers --- Flow.Launcher/MainWindow.xaml.cs | 6 ------ Flow.Launcher/ResultListBox.xaml | 2 +- Flow.Launcher/ViewModel/ResultViewModel.cs | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 900befe72..0c8fb4d02 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -323,12 +323,6 @@ namespace Flow.Launcher case nameof(Settings.ShowAtTopmost): Topmost = _settings.ShowAtTopmost; break; - case nameof(Settings.OpenResultModifiers): - if (_viewModel.QueryResultsSelected() && string.IsNullOrEmpty(_viewModel.QueryText)) - { - _viewModel.QueryResults(); - } - break; } }; diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index 9b5235217..e469bb63b 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -80,7 +80,7 @@ Style="{DynamicResource ItemHotkeyStyle}"> - + diff --git a/Flow.Launcher/ViewModel/ResultViewModel.cs b/Flow.Launcher/ViewModel/ResultViewModel.cs index df37fef09..c58abae28 100644 --- a/Flow.Launcher/ViewModel/ResultViewModel.cs +++ b/Flow.Launcher/ViewModel/ResultViewModel.cs @@ -149,8 +149,6 @@ namespace Flow.Launcher.ViewModel private bool PreviewImageAvailable => !string.IsNullOrEmpty(Result.Preview.PreviewImagePath) || Result.Preview.PreviewDelegate != null; - public string OpenResultModifiers => Settings.OpenResultModifiers; - public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip) ? Result.Title : Result.TitleToolTip;