From 91c5e84ca0f89d5ab0714ddcae86541c51b89778 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 29 Mar 2025 15:27:25 +0800 Subject: [PATCH] Integrate resize window to fixed window height --- Flow.Launcher.Core/Resource/Theme.cs | 10 ++-- .../UserSettings/Settings.cs | 58 +++++++++++-------- Flow.Launcher/Languages/en.xaml | 6 +- Flow.Launcher/MainWindow.xaml.cs | 6 +- .../ViewModels/SettingsPaneThemeViewModel.cs | 6 -- .../SettingPages/Views/SettingsPaneTheme.xaml | 22 +++---- 6 files changed, 52 insertions(+), 56 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 44802aa91..a1b2c3e0e 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -531,15 +531,15 @@ namespace Flow.Launcher.Core.Resource UpdateResourceDictionary(dict); } - public void SetResizeBoarderThickness(WindowChrome windowChrome, bool resizeWindow) + public void SetResizeBoarderThickness(WindowChrome windowChrome, bool fixedWindowSize) { - if (resizeWindow) + if (fixedWindowSize) { - windowChrome.ResizeBorderThickness = _themeResizeBorderThickness; + windowChrome.ResizeBorderThickness = new Thickness(0); } else { - windowChrome.ResizeBorderThickness = new Thickness(0); + windowChrome.ResizeBorderThickness = _themeResizeBorderThickness; } } @@ -565,7 +565,7 @@ namespace Flow.Launcher.Core.Resource } // Apply the resize border thickness to the window chrome - SetResizeBoarderThickness(windowChrome, _settings.ResizeWindow); + SetResizeBoarderThickness(windowChrome, _settings.KeepMaxResults); } } diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 7c747ae36..bd146f49a 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -68,11 +68,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings get => _theme; set { - if (value == _theme) - return; - _theme = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(MaxResultsToShow)); + if (value != _theme) + { + _theme = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(MaxResultsToShow)); + } } } public bool UseDropShadowEffect { get; set; } = true; @@ -113,25 +114,17 @@ namespace Flow.Launcher.Infrastructure.UserSettings public double? SettingWindowLeft { get; set; } = null; public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal; - bool _resizeWindow { get; set; } = true; - public bool ResizeWindow - { - get => _resizeWindow; - set - { - _resizeWindow = value; - OnPropertyChanged(); - } - } - bool _showPlaceholder { get; set; } = false; public bool ShowPlaceholder { get => _showPlaceholder; set { - _showPlaceholder = value; - OnPropertyChanged(); + if (_showPlaceholder != value) + { + _showPlaceholder = value; + OnPropertyChanged(); + } } } string _placeholderText { get; set; } = string.Empty; @@ -140,8 +133,11 @@ namespace Flow.Launcher.Infrastructure.UserSettings get => _placeholderText; set { - _placeholderText = value; - OnPropertyChanged(); + if (_placeholderText != value) + { + _placeholderText = value; + OnPropertyChanged(); + } } } @@ -273,10 +269,26 @@ namespace Flow.Launcher.Infrastructure.UserSettings /// public double CustomWindowTop { get; set; } = 0; - public bool KeepMaxResults { get; set; } = false; - public int MaxResultsToShow { get; set; } = 5; - public int ActivateTimes { get; set; } + /// + /// Fixed window size + /// + private bool _keepMaxResults { get; set; } = false; + public bool KeepMaxResults + { + get => _keepMaxResults; + set + { + if (_keepMaxResults != value) + { + _keepMaxResults = value; + OnPropertyChanged(); + } + } + } + public int MaxResultsToShow { get; set; } = 5; + + public int ActivateTimes { get; set; } public ObservableCollection CustomPluginHotkeys { get; set; } = new ObservableCollection(); diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index a9c5ab49f..6d890dfba 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -72,8 +72,6 @@ Empty last Query Preserve Last Action Keyword Select Last Action Keyword - Fixed Window Height - The window height is not adjustable by dragging. Maximum results shown You can also quickly adjust this by using CTRL+Plus and CTRL+Minus. Ignore hotkeys in fullscreen mode @@ -206,8 +204,8 @@ Display placeholder when query is empty Placeholder text Change placeholder text. Input empty will use: Type here to search - Allow window size change - Allow dragging the search window edges to change its size + Fixed Window Size + The window size is not adjustable by dragging. Hotkey diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6ffc010a6..3f0dcc3e1 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -252,7 +252,7 @@ namespace Flow.Launcher case nameof(Settings.PlaceholderText): _viewModel.PlaceholderText = _settings.PlaceholderText; break; - case nameof(Settings.ResizeWindow): + case nameof(Settings.KeepMaxResults): SetupResizeMode(); break; } @@ -1087,10 +1087,10 @@ namespace Flow.Launcher private void SetupResizeMode() { - ResizeMode = _settings.ResizeWindow ? ResizeMode.CanResize : ResizeMode.NoResize; + ResizeMode = _settings.KeepMaxResults ? ResizeMode.NoResize : ResizeMode.CanResize; if (WindowChrome.GetWindowChrome(this) is WindowChrome windowChrome) { - _theme.SetResizeBoarderThickness(windowChrome, _settings.ResizeWindow); + _theme.SetResizeBoarderThickness(windowChrome, _settings.KeepMaxResults); } } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 64fe351fa..099be496b 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -259,12 +259,6 @@ public partial class SettingsPaneThemeViewModel : BaseModel set => Settings.SoundVolume = value; } - public bool ResizeWindow - { - get => Settings.ResizeWindow; - set => Settings.ResizeWindow = value; - } - public bool ShowPlaceholder { get => Settings.ShowPlaceholder; diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index 462ea799e..f9eef8924 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -499,28 +499,20 @@ Text="{DynamicResource browserMoreThemes}" Uri="{Binding LinkThemeGallery}" /> - - - - - - + - +