From 91c9397b0fcff06405482f3b83a0eeac360ec74f Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 7 Sep 2022 14:15:16 +0900 Subject: [PATCH 01/12] - Quick Adjust Width Size by Ctrl + Plus/Minus --- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/MainWindow.xaml.cs | 44 +++++++++++++++++++++++++++++--- Flow.Launcher/SettingWindow.xaml | 2 ++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index bdf7450525c..0c7d19be0c0 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -124,6 +124,7 @@ Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. Window Width Size + You can quick adjust Ctrl+Plus/Minus Key in query box too. Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 2b7db38cff2..a6dd9ddef6a 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Threading.Tasks; using System.Windows; @@ -478,6 +478,7 @@ public double WindowTop() /// private void OnKeyDown(object sender, KeyEventArgs e) { + var specialKeyState = GlobalHotkey.CheckModifiers(); switch (e.Key) { case Key.Down: @@ -504,6 +505,12 @@ private void OnKeyDown(object sender, KeyEventArgs e) _viewModel.LoadContextMenuCommand.Execute(null); e.Handled = true; } + if (specialKeyState.CtrlPressed) + { + + _settings.WindowSize = _settings.WindowSize + 100; + Left = Left - 50; + } break; case Key.Left: if (!_viewModel.SelectedIsFromQueryResults() && QueryTextBox.CaretIndex == 0) @@ -511,9 +518,39 @@ private void OnKeyDown(object sender, KeyEventArgs e) _viewModel.EscCommand.Execute(null); e.Handled = true; } + if (specialKeyState.CtrlPressed) + { + if (_settings.WindowSize < 400) + { + } + else + { + _settings.WindowSize = _settings.WindowSize - 100; + Left = Left + 50; + } + } + break; + case Key.OemMinus: + if (specialKeyState.CtrlPressed) + { + if (_settings.WindowSize < 400) + { + } + else + { + _settings.WindowSize = _settings.WindowSize - 100; + Left = Left + 50; + } + } + break; + case Key.OemPlus: + if (specialKeyState.CtrlPressed) + { + _settings.WindowSize = _settings.WindowSize + 100; + Left = Left - 50; + } break; case Key.Back: - var specialKeyState = GlobalHotkey.CheckModifiers(); if (specialKeyState.CtrlPressed) { if (_viewModel.SelectedIsFromQueryResults() @@ -531,6 +568,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; + default: break; @@ -556,4 +594,4 @@ public void InitializeColorScheme() } } } -} \ No newline at end of file +} diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index ba6569771d1..cbb25247d73 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -1604,6 +1604,7 @@ + Date: Wed, 7 Sep 2022 14:45:07 +0900 Subject: [PATCH 02/12] - Add Quick adjust maxresultcount by CTRL+[ and ] --- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/MainWindow.xaml.cs | 18 ++++++++++++++++++ Flow.Launcher/SettingWindow.xaml | 12 +++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 0c7d19be0c0..6e3dd3a0e65 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -41,6 +41,7 @@ Select last Query Empty last Query Maximum results shown + You can quick adjust CTRL+[ and CTRL+] in query box. Ignore hotkeys in fullscreen mode Disable Flow Launcher activation when a full screen application is active (Recommended for games). Default File Manager diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index a6dd9ddef6a..6837d60ed39 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -550,6 +550,24 @@ private void OnKeyDown(object sender, KeyEventArgs e) Left = Left - 50; } break; + case Key.OemOpenBrackets: + if (specialKeyState.CtrlPressed) + { + if (_settings.MaxResultsToShow < 2) + { + } + else + { + _settings.MaxResultsToShow = _settings.MaxResultsToShow - 1; + } + } + break; + case Key.OemCloseBrackets: + if (specialKeyState.CtrlPressed) + { + _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; + } + break; case Key.Back: if (specialKeyState.CtrlPressed) { diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index cbb25247d73..5d62e627c31 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -768,11 +768,13 @@ BorderThickness="0" Style="{DynamicResource SettingGroupBox}"> - + + + + Date: Thu, 8 Sep 2022 16:44:00 +0900 Subject: [PATCH 03/12] - Add Ctrl+F12 to Toggle Game mode --- Flow.Launcher/MainWindow.xaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6837d60ed39..3366e78028b 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -568,6 +568,12 @@ private void OnKeyDown(object sender, KeyEventArgs e) _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; } break; + case Key.F12: + if (specialKeyState.CtrlPressed) + { + ToggleGameMode(); + } + break; case Key.Back: if (specialKeyState.CtrlPressed) { @@ -586,7 +592,6 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - default: break; From 9cfb92b6f34b61dd12789c46bb41c0445da0c909 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 8 Sep 2022 18:09:21 +0900 Subject: [PATCH 04/12] Change Shortcut each other (+-,[]) --- Flow.Launcher/Languages/en.xaml | 4 ++-- Flow.Launcher/MainWindow.xaml.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 6e3dd3a0e65..47041cdf096 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -41,7 +41,7 @@ Select last Query Empty last Query Maximum results shown - You can quick adjust CTRL+[ and CTRL+] in query box. + You can quick adjust CTRL+Plus and CTRL+Minus in query box. Ignore hotkeys in fullscreen mode Disable Flow Launcher activation when a full screen application is active (Recommended for games). Default File Manager @@ -125,7 +125,7 @@ Query window shadow effect Shadow effect has a substantial usage of GPU. Not recommended if your computer performance is limited. Window Width Size - You can quick adjust Ctrl+Plus/Minus Key in query box too. + You can quick adjust Ctrl+[, Ctrl+] in query box too. Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 3366e78028b..7c859b5507e 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -530,7 +530,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.OemMinus: + case Key.OemCloseBrackets: if (specialKeyState.CtrlPressed) { if (_settings.WindowSize < 400) @@ -543,14 +543,14 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.OemPlus: + case Key.OemOpenBrackets: if (specialKeyState.CtrlPressed) { _settings.WindowSize = _settings.WindowSize + 100; Left = Left - 50; } break; - case Key.OemOpenBrackets: + case Key.OemPlus: if (specialKeyState.CtrlPressed) { if (_settings.MaxResultsToShow < 2) @@ -562,7 +562,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.OemCloseBrackets: + case Key.OemMinus: if (specialKeyState.CtrlPressed) { _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; From e67e4fd99e4fc8f9b388ec958be7136da37d16ba Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 14 Sep 2022 11:01:28 +0900 Subject: [PATCH 05/12] Adjust Keys assign --- Flow.Launcher/MainWindow.xaml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 7c859b5507e..b3262b7fd42 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -530,7 +530,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.OemCloseBrackets: + case Key.OemOpenBrackets: if (specialKeyState.CtrlPressed) { if (_settings.WindowSize < 400) @@ -543,14 +543,14 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.OemOpenBrackets: + case Key.OemCloseBrackets: if (specialKeyState.CtrlPressed) { _settings.WindowSize = _settings.WindowSize + 100; Left = Left - 50; } break; - case Key.OemPlus: + case Key.OemMinus: if (specialKeyState.CtrlPressed) { if (_settings.MaxResultsToShow < 2) @@ -562,7 +562,7 @@ private void OnKeyDown(object sender, KeyEventArgs e) } } break; - case Key.OemMinus: + case Key.OemPlus: if (specialKeyState.CtrlPressed) { _settings.MaxResultsToShow = _settings.MaxResultsToShow + 1; From 01c9be37bf795ad7087c6b649ee3b53c3529a4f1 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Mon, 19 Sep 2022 15:32:17 -0500 Subject: [PATCH 06/12] Use Command in ViewModel to control data change (Add MVVM Toolkit to generate RelayCommand) --- Flow.Launcher/Flow.Launcher.csproj | 1 + Flow.Launcher/MainWindow.xaml | 20 +++++- Flow.Launcher/MainWindow.xaml.cs | 80 +++------------------- Flow.Launcher/ViewModel/MainViewModel.cs | 87 ++++++++++++++++++------ 4 files changed, 98 insertions(+), 90 deletions(-) diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 66cc911ee87..0db1915c50f 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -83,6 +83,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 714fcc53fa1..7730c5658f6 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -32,7 +32,9 @@ Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" WindowStartupLocation="Manual" WindowStyle="None" - mc:Ignorable="d"> + mc:Ignorable="d" + Left="{Binding Left, Mode=TwoWay}" + Top="{Binding Top, Mode=TwoWay}"> @@ -84,6 +86,22 @@ Modifiers="Ctrl" /> + + + + - { - if (args.PropertyName == nameof(Settings.WindowSize)) - { - OnPropertyChanged(nameof(MainWindowWidth)); - } - }; _historyItemsStorage = new FlowLauncherJsonStorage(); _userSelectedRecordStorage = new FlowLauncherJsonStorage(); @@ -82,6 +76,7 @@ public MainViewModel(Settings settings) _selectedResults = Results; InitializeKeyCommands(); + RegisterViewUpdate(); RegisterResultsUpdatedEvent(); @@ -154,6 +149,8 @@ private void RegisterResultsUpdatedEvent() } } + + private void InitializeKeyCommands() { EscCommand = new RelayCommand(_ => @@ -307,7 +304,7 @@ private void InitializeKeyCommands() Notification.Show( InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully") - ); + ); }), TaskScheduler.Default) .ConfigureAwait(false); }); @@ -318,9 +315,9 @@ private void InitializeKeyCommands() #region ViewModel Properties public ResultsViewModel Results { get; private set; } - + public ResultsViewModel ContextMenu { get; private set; } - + public ResultsViewModel History { get; private set; } public bool GameModeStatus { get; set; } @@ -336,6 +333,54 @@ public string QueryText } } + + public double Top + { + get => _settings.WindowTop; + set + { + _settings.WindowTop = value; + OnPropertyChanged(); + } + } + public double Left + { + get => _settings.WindowLeft; + set + { + _settings.WindowLeft = value; + OnPropertyChanged(); + } + } + + [RelayCommand] + private void IncreaseWidth() + { + MainWindowWidth += 100; + Left -= 50; + } + + [RelayCommand] + private void DecreaseWidth() + { + if (MainWindowWidth < 400) return; + Left += 50; + MainWindowWidth -= 100; + } + + [RelayCommand] + private void IncreaseMaxResult() + { + _settings.MaxResultsToShow += 1; + } + + [RelayCommand] + private void DecreaseMaxResult() + { + if (_settings.MaxResultsToShow < 2) return; + _settings.MaxResultsToShow -= 1; + } + /// /// we need move cursor to end when we manually changed query /// but we don't want to move cursor to end when query is updated from TextBox @@ -411,7 +456,11 @@ private ResultsViewModel SelectedResults public Visibility SearchIconVisibility { get; set; } - public double MainWindowWidth => _settings.WindowSize; + public double MainWindowWidth + { + get => _settings.WindowSize; + set => _settings.WindowSize = value; + } public string PluginIconPath { get; set; } = null; @@ -592,7 +641,7 @@ private async void QueryResults() PluginIconPath = null; SearchIconVisibility = Visibility.Visible; } - + if (query.ActionKeyword == Plugin.Query.GlobalPluginWildcardSign) { @@ -903,18 +952,18 @@ public void ResultCopy(string stringToCopy) Clipboard.SetFileDropList(paths); App.API.ShowMsg( - App.API.GetTranslation("copy") - +" " - + (isFile? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), + App.API.GetTranslation("copy") + + " " + + (isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle")), App.API.GetTranslation("completedSuccessfully")); } else { Clipboard.SetDataObject(copyText.ToString()); App.API.ShowMsg( - App.API.GetTranslation("copy") - + " " - + App.API.GetTranslation("textTitle"), + App.API.GetTranslation("copy") + + " " + + App.API.GetTranslation("textTitle"), App.API.GetTranslation("completedSuccessfully")); } } From 0baf04eb74558cf1422e25d99cd806f771609df3 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Tue, 27 Sep 2022 11:47:39 -0500 Subject: [PATCH 07/12] Merge branch 'dev' into QuickSizeAdjust & Work around dotnet/wpf#6792 --- Flow.Launcher.Plugin/Result.cs | 11 +++ Flow.Launcher/Flow.Launcher.csproj | 10 +++ Flow.Launcher/ReportWindow.xaml.cs | 1 - Flow.Launcher/ResultListBox.xaml | 6 +- Flow.Launcher/Themes/Base.xaml | 15 ++++ .../Search/ResultManager.cs | 88 ++++++++++++++++++- .../Search/SearchManager.cs | 9 +- .../Search/WindowsIndex/IndexSearch.cs | 6 +- global.json | 4 +- 9 files changed, 141 insertions(+), 9 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 35c491d35f8..13639546709 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -197,5 +197,16 @@ public ValueTask ExecuteAsync(ActionContext context) { return AsyncAction?.Invoke(context) ?? ValueTask.FromResult(Action?.Invoke(context) ?? false); } + + /// + /// Progress bar display. Providing an int value between 0-100 will trigger the progress bar to be displayed on the result + /// + public int? ProgressBar { get; set; } + + /// + /// Optionally set the color of the progress bar + /// + /// #26a0da (blue) + public string ProgressBarColor { get; set; } = "#26a0da"; } } diff --git a/Flow.Launcher/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 0db1915c50f..813a44527be 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -115,4 +115,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Flow.Launcher/ReportWindow.xaml.cs b/Flow.Launcher/ReportWindow.xaml.cs index 72c69d74d17..4899edc1463 100644 --- a/Flow.Launcher/ReportWindow.xaml.cs +++ b/Flow.Launcher/ReportWindow.xaml.cs @@ -77,7 +77,6 @@ private Paragraph Hyperlink(string textBeforeUrl, string url) }; link.Inlines.Add(url); link.NavigateUri = new Uri(url); - link.RequestNavigate += (s, e) => SearchWeb.OpenInBrowserTab(e.Uri.ToString()); link.Click += (s, e) => SearchWeb.OpenInBrowserTab(url); paragraph.Inlines.Add(textBeforeUrl); diff --git a/Flow.Launcher/ResultListBox.xaml b/Flow.Launcher/ResultListBox.xaml index f7e82005008..2c78f9babbf 100644 --- a/Flow.Launcher/ResultListBox.xaml +++ b/Flow.Launcher/ResultListBox.xaml @@ -111,7 +111,11 @@ - + + +