From a4dac91093960175e48aec20f9186f545ec7c228 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 29 Mar 2025 13:25:00 +0800 Subject: [PATCH] Support resize window --- .../UserSettings/Settings.cs | 13 ++++++++++++- Flow.Launcher/Languages/en.xaml | 12 +++++++----- Flow.Launcher/MainWindow.xaml.cs | 15 +++++++++++++++ .../ViewModels/SettingsPaneThemeViewModel.cs | 6 ++++++ .../SettingPages/Views/SettingsPaneTheme.xaml | 19 +++++++++++++++++-- 5 files changed, 57 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 38c4fbe11..cae5d977f 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -113,7 +113,18 @@ namespace Flow.Launcher.Infrastructure.UserSettings public double? SettingWindowLeft { get; set; } = null; public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal; - bool _showPlaceholder { get; set; } = true; + bool _resizeWindow { get; set; } = true; + public bool ResizeWindow + { + get => _resizeWindow; + set + { + _resizeWindow = value; + OnPropertyChanged(); + } + } + + bool _showPlaceholder { get; set; } = false; public bool ShowPlaceholder { get => _showPlaceholder; diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index f4e2d88af..656431e78 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -104,11 +104,6 @@ Always Preview Always open preview panel when Flow activates. Press {0} to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled - Backdrop Type - None - Acrylic - Mica - Mica Alt Search Plugin @@ -200,10 +195,17 @@ Custom Clock Date + Backdrop Type + None + Acrylic + Mica + Mica Alt This theme supports two(light/dark) modes. This theme supports Blur Transparent Background. Placeholder Text Display placeholder text when query is empty + Allow window size change + Allow dragging the search window edges to change its size Hotkey diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 85eff3a57..097ce7df4 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -115,6 +115,9 @@ namespace Flow.Launcher welcomeWindow.Show(); } + // Initialize resize mode + SetupResizeMode(); + // Initialize place holder SetupPlaceholderText(); @@ -243,6 +246,9 @@ namespace Flow.Launcher case nameof(Settings.ShowPlaceholder): SetupPlaceholderText(); break; + case nameof(Settings.ResizeWindow): + SetupResizeMode(); + break; } }; @@ -1071,6 +1077,15 @@ namespace Flow.Launcher #endregion + #region Resize Mode + + private void SetupResizeMode() + { + ResizeMode = _settings.ResizeWindow ? ResizeMode.CanResize : ResizeMode.NoResize; + } + + #endregion + #region IDisposable protected virtual void Dispose(bool disposing) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index 6e83d487a..9c32e9bb9 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -259,6 +259,12 @@ 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 5b92ee9b9..3abf46f09 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -30,6 +30,7 @@ VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.ScrollUnit="Pixel"> + + @@ -260,7 +262,8 @@ - + + - + + + + + +