From 02036f13a401cb87628aa2f3229de57312d28f29 Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 20 Oct 2021 23:58:34 +0900 Subject: [PATCH 01/17] add width slider --- .../UserSettings/Settings.cs | 11 +++++++++- Flow.Launcher/SettingWindow.xaml | 20 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 907314ba88e..b9afa819acf 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -10,10 +10,19 @@ namespace Flow.Launcher.Infrastructure.UserSettings public class Settings : BaseModel { private string language = "en"; - + private int windowsize = 580; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public bool ShowOpenResultHotkey { get; set; } = true; + public int WindowSize + { + get => windowsize; set + { + windowsize = value; + OnPropertyChanged(); + } + } + public string Language { get => language; set diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 7dc8829bec7..8873d8aaede 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -674,6 +674,24 @@ + + + + + + + + + + + +  + + + + + @@ -753,6 +771,7 @@ + @@ -765,6 +784,7 @@ + From 616e98af6022615797df4258703a2cfd51ea6aa1 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 21 Oct 2021 10:07:11 +0900 Subject: [PATCH 02/17] wip --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 4 ++-- Flow.Launcher/Themes/Base.xaml | 5 +++-- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index b9afa819acf..99879e64e83 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -10,11 +10,11 @@ namespace Flow.Launcher.Infrastructure.UserSettings public class Settings : BaseModel { private string language = "en"; - private int windowsize = 580; + public double windowsize = 580; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public bool ShowOpenResultHotkey { get; set; } = true; - public int WindowSize + public double WindowSize { get => windowsize; set { diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index 19612af7058..d7df48d939e 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -1,6 +1,7 @@  + xmlns:system="clr-namespace:System;assembly=mscorlib" + xmlns:userSettings="clr-namespace:Flow.Launcher"> diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index e85d01b1ba1..cbb99962b70 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -304,6 +304,12 @@ public bool DropShadowEffect } } + public double WindowWidthSize + { + get { return Settings.WindowSize; } + set { Settings.WindowSize = value; } + } + public bool UseGlyphIcons { get { return Settings.UseGlyphIcons; } From 6af1262ca6255ec7ad58b6e86d3fbb0abc5873f9 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 21 Oct 2021 18:16:05 +0900 Subject: [PATCH 03/17] Adjust Width in Theme.cs --- Flow.Launcher.Core/Resource/Theme.cs | 7 ++++--- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 + Flow.Launcher/SettingWindow.xaml | 2 +- Flow.Launcher/Themes/Base.xaml | 4 ++-- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index 4648aef637c..d934491beb2 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -191,7 +191,7 @@ public ResourceDictionary GetResourceDictionary() } var windowStyle = dict["WindowStyle"] as Style; - + /* var width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") .Select(x => x.Value).FirstOrDefault(); @@ -202,9 +202,10 @@ public ResourceDictionary GetResourceDictionary() width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") .Select(x => x.Value).FirstOrDefault(); } - + */ + var width = Settings.WindowSize; + windowStyle.Setters.Add(new Setter(Window.WidthProperty, width)); mainWindowWidth = (double)width; - return dict; } diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 99879e64e83..3bae6a24c7c 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -21,6 +21,7 @@ public double WindowSize windowsize = value; OnPropertyChanged(); } + } public string Language diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 8873d8aaede..403e6adaf77 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -683,7 +683,7 @@ Click="OpenPluginFolder" Grid.Column="2">Open Theme Folder--> - +  diff --git a/Flow.Launcher/Themes/Base.xaml b/Flow.Launcher/Themes/Base.xaml index d7df48d939e..ad13e010178 100644 --- a/Flow.Launcher/Themes/Base.xaml +++ b/Flow.Launcher/Themes/Base.xaml @@ -1,7 +1,7 @@  + xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"> diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index cbb99962b70..b5fc2d80345 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -307,7 +307,7 @@ public bool DropShadowEffect public double WindowWidthSize { get { return Settings.WindowSize; } - set { Settings.WindowSize = value; } + set { Settings.WindowSize = value;} } public bool UseGlyphIcons From 5e0172cbf6e4852c3d3970c352d7f5827a65cf7e Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 21 Oct 2021 18:31:14 +0900 Subject: [PATCH 04/17] - Remove Comment - Add String "Window Width Size" --- Flow.Launcher.Core/Resource/Theme.cs | 14 +------------- .../UserSettings/Settings.cs | 2 +- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/SettingWindow.xaml | 6 ++---- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 2 +- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index d934491beb2..efd311acb3f 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -189,20 +189,8 @@ public ResourceDictionary GetResourceDictionary() new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } - + /* Ignore Theme Window Width and use setting */ var windowStyle = dict["WindowStyle"] as Style; - /* - var width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") - .Select(x => x.Value).FirstOrDefault(); - - if (width == null) - { - windowStyle = dict["BaseWindowStyle"] as Style; - - width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") - .Select(x => x.Value).FirstOrDefault(); - } - */ var width = Settings.WindowSize; windowStyle.Setters.Add(new Setter(Window.WidthProperty, width)); mainWindowWidth = (double)width; diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 3bae6a24c7c..1d410013845 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; - +using Flow.Launcher; namespace Flow.Launcher.Infrastructure.UserSettings { public class Settings : BaseModel diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 4a9b9270071..bbb56b9ec49 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -82,6 +82,7 @@ Are you sure you want to delete {0} plugin hotkey? Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. + Window Width Size Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 403e6adaf77..e74cfff7979 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -677,13 +677,11 @@ - + - - +  diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index b5fc2d80345..0fb6e6969a8 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -307,7 +307,7 @@ public bool DropShadowEffect public double WindowWidthSize { get { return Settings.WindowSize; } - set { Settings.WindowSize = value;} + set { Settings.WindowSize = value; ThemeManager.Instance.ChangeTheme(Settings.Theme); } } public bool UseGlyphIcons From 6b37adaf0797a407696032cfa3692caac8bca22f Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 21 Oct 2021 18:31:14 +0900 Subject: [PATCH 05/17] - Remove Comment - Add String "Window Width Size" --- Flow.Launcher.Core/Resource/Theme.cs | 14 +------------- .../UserSettings/Settings.cs | 2 +- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/SettingWindow.xaml | 6 ++---- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 6 +++++- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index d934491beb2..efd311acb3f 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -189,20 +189,8 @@ public ResourceDictionary GetResourceDictionary() new[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle, resultHotkeyItemStyle, resultHotkeyItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p))); } - + /* Ignore Theme Window Width and use setting */ var windowStyle = dict["WindowStyle"] as Style; - /* - var width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") - .Select(x => x.Value).FirstOrDefault(); - - if (width == null) - { - windowStyle = dict["BaseWindowStyle"] as Style; - - width = windowStyle?.Setters.OfType().Where(x => x.Property.Name == "Width") - .Select(x => x.Value).FirstOrDefault(); - } - */ var width = Settings.WindowSize; windowStyle.Setters.Add(new Setter(Window.WidthProperty, width)); mainWindowWidth = (double)width; diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 3bae6a24c7c..1d410013845 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -4,7 +4,7 @@ using System.Text.Json.Serialization; using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; - +using Flow.Launcher; namespace Flow.Launcher.Infrastructure.UserSettings { public class Settings : BaseModel diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 4a9b9270071..bbb56b9ec49 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -82,6 +82,7 @@ Are you sure you want to delete {0} plugin hotkey? Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. + Window Width Size Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 403e6adaf77..8e20232ac3e 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -677,13 +677,11 @@ - + - - +  diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index b5fc2d80345..67d16711314 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -307,7 +307,11 @@ public bool DropShadowEffect public double WindowWidthSize { get { return Settings.WindowSize; } - set { Settings.WindowSize = value;} + set + { + Settings.WindowSize = value; + ThemeManager.Instance.ChangeTheme(Settings.Theme); + } } public bool UseGlyphIcons From 5be44b68eadc64238bb8c9c1b0764440668a0491 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 21 Oct 2021 23:31:51 -0500 Subject: [PATCH 06/17] Add fody and use binding to change width --- Flow.Launcher.Core/Resource/Theme.cs | 1 - .../Flow.Launcher.Infrastructure.csproj | 5 +++++ .../UserSettings/Settings.cs | 17 +++++--------- Flow.Launcher/MainWindow.xaml | 1 + Flow.Launcher/MainWindow.xaml.cs | 5 +++++ Flow.Launcher/ViewModel/MainViewModel.cs | 10 +++++++++ .../ViewModel/SettingWindowViewModel.cs | 22 +++++++++---------- 7 files changed, 36 insertions(+), 25 deletions(-) diff --git a/Flow.Launcher.Core/Resource/Theme.cs b/Flow.Launcher.Core/Resource/Theme.cs index efd311acb3f..3abb426cba1 100644 --- a/Flow.Launcher.Core/Resource/Theme.cs +++ b/Flow.Launcher.Core/Resource/Theme.cs @@ -365,7 +365,6 @@ private void SetWindowAccent(Window w, AccentState state) var windowHelper = new WindowInteropHelper(w); // this determines the width of the main query window - w.Width = mainWindowWidth; windowHelper.EnsureHandle(); var accent = new AccentPolicy { AccentState = state }; diff --git a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj index ef76fd61724..e01bc1efd56 100644 --- a/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj +++ b/Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj @@ -50,10 +50,15 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 1d410013845..614fc1de812 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -5,28 +5,21 @@ using Flow.Launcher.Plugin; using Flow.Launcher.Plugin.SharedModels; using Flow.Launcher; + namespace Flow.Launcher.Infrastructure.UserSettings { public class Settings : BaseModel { private string language = "en"; - public double windowsize = 580; public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}"; public string OpenResultModifiers { get; set; } = KeyConstant.Alt; public bool ShowOpenResultHotkey { get; set; } = true; - public double WindowSize - { - get => windowsize; set - { - windowsize = value; - OnPropertyChanged(); - } - - } + public double WindowSize { get; set; } = 580; public string Language { - get => language; set + get => language; + set { language = value; OnPropertyChanged(); @@ -62,7 +55,7 @@ public string QuerySearchPrecisionString try { var precisionScore = (SearchPrecisionScore)Enum - .Parse(typeof(SearchPrecisionScore), value); + .Parse(typeof(SearchPrecisionScore), value); QuerySearchPrecision = precisionScore; StringMatcher.Instance.UserSettingSearchPrecision = precisionScore; diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 73b13be8c95..dbf329b58ad 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -26,6 +26,7 @@ LocationChanged="OnLocationChanged" Deactivated="OnDeactivated" PreviewKeyDown="OnKeyDown" + Width="{Binding MainWindowWidth, Mode=OneTime}" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" d:DataContext="{d:DesignInstance vm:MainViewModel}"> diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 057c3f07d09..79682806c64 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -19,6 +19,7 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; using NotifyIcon = System.Windows.Forms.NotifyIcon; +using System.Windows.Interop; namespace Flow.Launcher { @@ -131,6 +132,10 @@ private void OnLoaded(object sender, RoutedEventArgs _) _viewModel.QueryTextCursorMovedToEnd = false; } break; + case nameof(MainViewModel.MainWindowWidth): + MinWidth = _viewModel.MainWindowWidth; + MaxWidth = _viewModel.MainWindowWidth; + break; } }; _settings.PropertyChanged += (o, e) => diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index e5401411034..522d10b3a29 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -22,6 +22,7 @@ using ISavable = Flow.Launcher.Plugin.ISavable; using System.Windows.Threading; using NHotkey; +using Windows.Web.Syndication; namespace Flow.Launcher.ViewModel @@ -63,6 +64,13 @@ public MainViewModel(Settings settings) _lastQuery = new Query(); _settings = settings; + _settings.PropertyChanged += (_, args) => + { + if (args.PropertyName == nameof(Settings.WindowSize)) + { + OnPropertyChanged(nameof(MainWindowWidth)); + } + }; _historyItemsStorage = new FlowLauncherJsonStorage(); _userSelectedRecordStorage = new FlowLauncherJsonStorage(); @@ -378,6 +386,8 @@ private ResultsViewModel SelectedResults public Visibility ProgressBarVisibility { get; set; } public Visibility MainWindowVisibility { get; set; } + public double MainWindowWidth => _settings.WindowSize; + public ICommand EscCommand { get; set; } public ICommand SelectNextItemCommand { get; set; } public ICommand SelectPrevItemCommand { get; set; } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 67d16711314..e2c1d970054 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -35,9 +35,11 @@ public SettingWindowViewModel(Updater updater, IPortable portable) Settings = _storage.Load(); Settings.PropertyChanged += (s, e) => { - if (e.PropertyName == nameof(Settings.ActivateTimes)) + switch (e.PropertyName) { - OnPropertyChanged(nameof(ActivatedTimes)); + case nameof(Settings.ActivateTimes): + OnPropertyChanged(nameof(ActivatedTimes)); + break; } }; } @@ -51,7 +53,7 @@ public async void UpdateApp() public bool AutoUpdates { - get { return Settings.AutoUpdates; } + get => Settings.AutoUpdates; set { Settings.AutoUpdates = value; @@ -71,7 +73,7 @@ public bool AutoHideScrollBar private bool _portableMode = DataLocation.PortableDataLocationInUse(); public bool PortableMode { - get { return _portableMode; } + get => _portableMode; set { if (!_portable.CanUpdatePortability()) @@ -306,18 +308,14 @@ public bool DropShadowEffect public double WindowWidthSize { - get { return Settings.WindowSize; } - set - { - Settings.WindowSize = value; - ThemeManager.Instance.ChangeTheme(Settings.Theme); - } + get => Settings.WindowSize; + set => Settings.WindowSize = value; } public bool UseGlyphIcons { - get { return Settings.UseGlyphIcons; } - set { Settings.UseGlyphIcons = value; } + get => Settings.UseGlyphIcons; + set => Settings.UseGlyphIcons = value; } public Brush PreviewBackground From 674d6154a2156282b9c8bba03e18d5078d308429 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 22 Oct 2021 14:39:26 +0900 Subject: [PATCH 07/17] Display Querybox when Using Width slider. --- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index e2c1d970054..c869f560154 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -309,7 +309,11 @@ public bool DropShadowEffect public double WindowWidthSize { get => Settings.WindowSize; - set => Settings.WindowSize = value; + set + { + Settings.WindowSize = value; + Application.Current.MainWindow.Visibility = Visibility.Visible; + } } public bool UseGlyphIcons From 08c643adcc58f90843ddaa9badc2e21ec4c1ca9e Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 22 Oct 2021 16:41:35 +0900 Subject: [PATCH 08/17] Add "IsMoveToPointEnabled" property --- Flow.Launcher/SettingWindow.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 8e20232ac3e..9126ab4a195 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -681,7 +681,7 @@ - +  From 64a489b3129914543befa8ad4eeae4fc535d97e0 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Fri, 22 Oct 2021 13:41:36 -0500 Subject: [PATCH 09/17] Use Hacky way to show up windows when width change. Clear query to prevent large area of window preventing user change width. --- Flow.Launcher/ViewModel/MainViewModel.cs | 15 +++++++++++++-- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 6 +----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 522d10b3a29..cd6392cb61f 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -52,6 +52,7 @@ public class MainViewModel : BaseModel, ISavable private ChannelWriter _resultsUpdateChannelWriter; private Task _resultsViewUpdateTask; + private bool _keepVisibility = false; #endregion @@ -64,10 +65,20 @@ public MainViewModel(Settings settings) _lastQuery = new Query(); _settings = settings; - _settings.PropertyChanged += (_, args) => + _settings.PropertyChanged += async (_, args) => { if (args.PropertyName == nameof(Settings.WindowSize)) { + ChangeQueryText(""); + if (MainWindowVisibility == Visibility.Collapsed) + { + ToggleFlowLauncher(); + _keepVisibility = true; + await Task.Delay(1000); + _keepVisibility = false; + Application.Current.MainWindow.Activate(); + } + OnPropertyChanged(nameof(MainWindowWidth)); } }; @@ -742,7 +753,7 @@ public async void ToggleFlowLauncher() public void Hide() { - if (MainWindowVisibility != Visibility.Collapsed) + if (MainWindowVisibility != Visibility.Collapsed && !_keepVisibility) { ToggleFlowLauncher(); } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index c869f560154..e2c1d970054 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -309,11 +309,7 @@ public bool DropShadowEffect public double WindowWidthSize { get => Settings.WindowSize; - set - { - Settings.WindowSize = value; - Application.Current.MainWindow.Visibility = Visibility.Visible; - } + set => Settings.WindowSize = value; } public bool UseGlyphIcons From a83f9df19c978787220cf0f57167ee1b33176d00 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Fri, 22 Oct 2021 13:57:22 -0500 Subject: [PATCH 10/17] Revert "Use Hacky way to show up windows when width change." This reverts commit 64a489b3129914543befa8ad4eeae4fc535d97e0. --- Flow.Launcher/ViewModel/MainViewModel.cs | 15 ++------------- Flow.Launcher/ViewModel/SettingWindowViewModel.cs | 6 +++++- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index cd6392cb61f..522d10b3a29 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -52,7 +52,6 @@ public class MainViewModel : BaseModel, ISavable private ChannelWriter _resultsUpdateChannelWriter; private Task _resultsViewUpdateTask; - private bool _keepVisibility = false; #endregion @@ -65,20 +64,10 @@ public MainViewModel(Settings settings) _lastQuery = new Query(); _settings = settings; - _settings.PropertyChanged += async (_, args) => + _settings.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(Settings.WindowSize)) { - ChangeQueryText(""); - if (MainWindowVisibility == Visibility.Collapsed) - { - ToggleFlowLauncher(); - _keepVisibility = true; - await Task.Delay(1000); - _keepVisibility = false; - Application.Current.MainWindow.Activate(); - } - OnPropertyChanged(nameof(MainWindowWidth)); } }; @@ -753,7 +742,7 @@ public async void ToggleFlowLauncher() public void Hide() { - if (MainWindowVisibility != Visibility.Collapsed && !_keepVisibility) + if (MainWindowVisibility != Visibility.Collapsed) { ToggleFlowLauncher(); } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index e2c1d970054..c869f560154 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -309,7 +309,11 @@ public bool DropShadowEffect public double WindowWidthSize { get => Settings.WindowSize; - set => Settings.WindowSize = value; + set + { + Settings.WindowSize = value; + Application.Current.MainWindow.Visibility = Visibility.Visible; + } } public bool UseGlyphIcons From 9d3096050f51c6a9876234fc8a15b01ac204d4e4 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Fri, 22 Oct 2021 15:26:13 -0500 Subject: [PATCH 11/17] Bind width to preview --- Flow.Launcher/SettingWindow.xaml | 250 +++++++++--------- .../ViewModel/SettingWindowViewModel.cs | 6 +- 2 files changed, 124 insertions(+), 132 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 9126ab4a195..a696aefddcd 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -68,7 +68,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -432,7 +432,7 @@ - + @@ -457,32 +457,32 @@ - - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - @@ -494,63 +494,63 @@ - - - + - - - + + - - - - - - - + + + + - - - - - + + + + - + - - - - - - - + + + + + + + - - + + @@ -561,7 +561,7 @@ - + @@ -587,7 +587,7 @@ - + @@ -600,6 +600,35 @@ + + + + + + + + + +  + + + + + + + + + + + + + +  + + + + + - - - - - - - - - - -  - - - - - - - - - - - - - - - - -  - - - - - @@ -789,8 +785,8 @@ - - + + @@ -895,8 +891,8 @@ - - + + @@ -910,7 +906,7 @@ - + @@ -977,53 +973,53 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - + Click="OpenPluginFolder" + Content="{DynamicResource OpenThemeFolder}" + DockPanel.Dock="Top" /> + @@ -1312,17 +1546,21 @@ - + - + - + @@ -1331,83 +1569,99 @@ - + - + - - + + - - - + + + - + - + - - + + - + SelectedItem="{Binding Settings.OpenResultModifiers}" /> - - + + - - - + + + - + - - + + Style="{StaticResource {x:Static GridView.GridViewStyleKey}}"> - + - + @@ -1417,21 +1671,31 @@ - -