From ddbbd693e8992c8c8f18d21f71f3dff2a01e02d2 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Wed, 12 Feb 2025 15:06:15 +0800
Subject: [PATCH 1/8] Make sure back to query results from context menu before
changing query
---
Flow.Launcher/CustomQueryHotkeySetting.xaml.cs | 1 +
Flow.Launcher/CustomShortcutSetting.xaml.cs | 1 +
Flow.Launcher/ResultListBox.xaml.cs | 3 +++
Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs | 1 +
Flow.Launcher/ViewModel/PluginViewModel.cs | 1 +
5 files changed, 7 insertions(+)
diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
index 81e7600b8..3db49b381 100644
--- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
+++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
@@ -76,6 +76,7 @@ namespace Flow.Launcher
private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
{
+ App.API.BackToQueryResults();
App.API.ChangeQuery(tbAction.Text);
Application.Current.MainWindow.Show();
Application.Current.MainWindow.Opacity = 1;
diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs
index dec3506eb..10452726d 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml.cs
+++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs
@@ -64,6 +64,7 @@ namespace Flow.Launcher
private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
{
+ App.API.BackToQueryResults();
App.API.ChangeQuery(tbExpand.Text);
Application.Current.MainWindow.Show();
Application.Current.MainWindow.Opacity = 1;
diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs
index ac51b195c..cc003457f 100644
--- a/Flow.Launcher/ResultListBox.xaml.cs
+++ b/Flow.Launcher/ResultListBox.xaml.cs
@@ -149,7 +149,10 @@ namespace Flow.Launcher
var rawQuery = query;
var effect = DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
if (effect == DragDropEffects.Move)
+ {
+ App.API.BackToQueryResults();
App.API.ChangeQuery(rawQuery, true);
+ }
}
private void ResultListBox_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
diff --git a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
index 38b5bec65..97c938e78 100644
--- a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
@@ -64,6 +64,7 @@ namespace Flow.Launcher.ViewModel
private void ShowCommandQuery(string action)
{
var actionKeyword = PluginManagerData.Metadata.ActionKeywords.Any() ? PluginManagerData.Metadata.ActionKeywords[0] + " " : String.Empty;
+ App.API.BackToQueryResults();
App.API.ChangeQuery($"{actionKeyword}{action} {_plugin.Name}");
App.API.ShowMainWindow();
}
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index 4ce8bd470..e56e8e9e5 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -146,6 +146,7 @@ namespace Flow.Launcher.ViewModel
[RelayCommand]
private void OpenDeletePluginWindow()
{
+ PluginManager.API.BackToQueryResults();
PluginManager.API.ChangeQuery($"{PluginManagerActionKeyword} uninstall {PluginPair.Metadata.Name}".Trim(), true);
PluginManager.API.ShowMainWindow();
}
From 2843236214981585fb2316ea25e675cf56bc21f3 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Wed, 19 Feb 2025 17:09:09 +0800
Subject: [PATCH 2/8] Improve documents & Improve code quality
---
Flow.Launcher/CustomQueryHotkeySetting.xaml.cs | 1 +
Flow.Launcher/CustomShortcutSetting.xaml.cs | 1 +
Flow.Launcher/ResultListBox.xaml.cs | 1 +
Flow.Launcher/ViewModel/MainViewModel.cs | 2 ++
Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs | 1 +
Flow.Launcher/ViewModel/PluginViewModel.cs | 1 +
Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs | 1 -
Plugins/Flow.Launcher.Plugin.Shell/Main.cs | 5 +++--
8 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
index 3db49b381..fd829afe2 100644
--- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
+++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
@@ -76,6 +76,7 @@ namespace Flow.Launcher
private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
{
+ // if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery(tbAction.Text);
Application.Current.MainWindow.Show();
diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs
index 10452726d..d05a5c15c 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml.cs
+++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs
@@ -64,6 +64,7 @@ namespace Flow.Launcher
private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
{
+ // if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery(tbExpand.Text);
Application.Current.MainWindow.Show();
diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs
index cc003457f..834692536 100644
--- a/Flow.Launcher/ResultListBox.xaml.cs
+++ b/Flow.Launcher/ResultListBox.xaml.cs
@@ -150,6 +150,7 @@ namespace Flow.Launcher
var effect = DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
if (effect == DragDropEffects.Move)
{
+ // if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery(rawQuery, true);
}
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 5c3251bfc..4af93daf9 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -1266,6 +1266,7 @@ namespace Flow.Launcher.ViewModel
{
_topMostRecord.Remove(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
+ // if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ReQuery();
return false;
@@ -1284,6 +1285,7 @@ namespace Flow.Launcher.ViewModel
{
_topMostRecord.AddOrUpdate(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
+ // if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ReQuery();
return false;
diff --git a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
index 97c938e78..7675ecb16 100644
--- a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
@@ -64,6 +64,7 @@ namespace Flow.Launcher.ViewModel
private void ShowCommandQuery(string action)
{
var actionKeyword = PluginManagerData.Metadata.ActionKeywords.Any() ? PluginManagerData.Metadata.ActionKeywords[0] + " " : String.Empty;
+ // if user happens to open context menu, we need to return back to query results before changing query
App.API.BackToQueryResults();
App.API.ChangeQuery($"{actionKeyword}{action} {_plugin.Name}");
App.API.ShowMainWindow();
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index e56e8e9e5..c8601c431 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -146,6 +146,7 @@ namespace Flow.Launcher.ViewModel
[RelayCommand]
private void OpenDeletePluginWindow()
{
+ // if user happens to open context menu, we need to return back to query results before changing query
PluginManager.API.BackToQueryResults();
PluginManager.API.ChangeQuery($"{PluginManagerActionKeyword} uninstall {PluginPair.Metadata.Name}".Trim(), true);
PluginManager.API.ShowMainWindow();
diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs
index 17e9fe2bc..482e821dc 100644
--- a/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs
+++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/ContextMenu.cs
@@ -59,7 +59,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
var link = pluginManifestInfo.UrlSourceCode.StartsWith("https://github.com")
? Regex.Replace(pluginManifestInfo.UrlSourceCode, @"\/tree\/\w+$", "") + "/issues"
: pluginManifestInfo.UrlSourceCode;
-
Context.API.OpenUrl(link);
return true;
}
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
index 7f1f4bd4d..86808cfbc 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
@@ -5,7 +5,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using System.Windows;
using WindowsInput;
using WindowsInput.Native;
using Flow.Launcher.Infrastructure.Hotkey;
@@ -379,9 +378,11 @@ namespace Flow.Launcher.Plugin.Shell
private void OnWinRPressed()
{
// show the main window and set focus to the query box
- Task.Run(() =>
+ _ = Task.Run(() =>
{
context.API.ShowMainWindow();
+ // if user happens to open context menu, we need to return back to query results before changing query
+ context.API.BackToQueryResults();
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}");
});
From aee585620a62a5054428d0a338e84a25af58bb9f Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 22 Feb 2025 19:32:08 +0800
Subject: [PATCH 3/8] Remove back to query result and call this function in
ChangeQuery & ReQuery
---
.../Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs | 5 -----
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 11 +++--------
Flow.Launcher/CustomQueryHotkeySetting.xaml.cs | 2 --
Flow.Launcher/CustomShortcutSetting.xaml.cs | 2 --
Flow.Launcher/PublicAPIInstance.cs | 2 --
Flow.Launcher/ResultListBox.xaml.cs | 4 ----
Flow.Launcher/ViewModel/MainViewModel.cs | 14 +++++---------
.../ViewModel/PluginStoreItemViewModel.cs | 2 --
Flow.Launcher/ViewModel/PluginViewModel.cs | 3 ---
Plugins/Flow.Launcher.Plugin.Program/Main.cs | 1 -
Plugins/Flow.Launcher.Plugin.Shell/Main.cs | 1 -
11 files changed, 8 insertions(+), 39 deletions(-)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs b/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
index e0a0434a2..a82cae5d2 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
@@ -170,10 +170,5 @@ namespace Flow.Launcher.Core.Plugin.JsonRPCV2Models
{
_api.OpenAppUri(appUri);
}
-
- public void BackToQueryResults()
- {
- _api.BackToQueryResults();
- }
}
}
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index 8376fd07b..1a8da381b 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -17,7 +17,8 @@ namespace Flow.Launcher.Plugin
public interface IPublicAPI
{
///
- /// Change Flow.Launcher query
+ /// Change Flow.Launcher query.
+ /// When current results is from context menu or history, we will back to query results before changing query.
///
/// query text
///
@@ -299,17 +300,11 @@ namespace Flow.Launcher.Plugin
///
/// Reloads the query.
- /// This method should run when selected item is from query results.
+ /// When current results is from context menu or history, we will back to query results before changing query.
///
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);
- ///
- /// Back to the query results.
- /// This method should run when selected item is from context menu or history.
- ///
- public void BackToQueryResults();
-
///
/// Displays a standardised Flow message box.
///
diff --git a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
index fd829afe2..81e7600b8 100644
--- a/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
+++ b/Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
@@ -76,8 +76,6 @@ namespace Flow.Launcher
private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
{
- // if user happens to open context menu, we need to return back to query results before changing query
- App.API.BackToQueryResults();
App.API.ChangeQuery(tbAction.Text);
Application.Current.MainWindow.Show();
Application.Current.MainWindow.Opacity = 1;
diff --git a/Flow.Launcher/CustomShortcutSetting.xaml.cs b/Flow.Launcher/CustomShortcutSetting.xaml.cs
index d05a5c15c..dec3506eb 100644
--- a/Flow.Launcher/CustomShortcutSetting.xaml.cs
+++ b/Flow.Launcher/CustomShortcutSetting.xaml.cs
@@ -64,8 +64,6 @@ namespace Flow.Launcher
private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
{
- // if user happens to open context menu, we need to return back to query results before changing query
- App.API.BackToQueryResults();
App.API.ChangeQuery(tbExpand.Text);
Application.Current.MainWindow.Show();
Application.Current.MainWindow.Opacity = 1;
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index 7706a64ba..d7f052af3 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -319,8 +319,6 @@ namespace Flow.Launcher
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
- public void BackToQueryResults() => _mainVM.BackToQueryResults();
-
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs
index 834692536..ac51b195c 100644
--- a/Flow.Launcher/ResultListBox.xaml.cs
+++ b/Flow.Launcher/ResultListBox.xaml.cs
@@ -149,11 +149,7 @@ namespace Flow.Launcher
var rawQuery = query;
var effect = DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
if (effect == DragDropEffects.Move)
- {
- // if user happens to open context menu, we need to return back to query results before changing query
- App.API.BackToQueryResults();
App.API.ChangeQuery(rawQuery, true);
- }
}
private void ResultListBox_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index 4af93daf9..d8e33ad14 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -279,10 +279,8 @@ namespace Flow.Launcher.ViewModel
public void ReQuery(bool reselect)
{
- if (SelectedIsFromQueryResults())
- {
- QueryResults(isReQuery: true, reSelect: reselect);
- }
+ BackToQueryResults();
+ QueryResults(isReQuery: true, reSelect: reselect);
}
[RelayCommand]
@@ -491,7 +489,7 @@ namespace Flow.Launcher.ViewModel
}
}
- public void BackToQueryResults()
+ private void BackToQueryResults()
{
if (!SelectedIsFromQueryResults())
{
@@ -610,6 +608,8 @@ namespace Flow.Launcher.ViewModel
{
Application.Current.Dispatcher.Invoke(() =>
{
+ BackToQueryResults();
+
if (QueryText != queryText)
{
// re-query is done in QueryText's setter method
@@ -1266,8 +1266,6 @@ namespace Flow.Launcher.ViewModel
{
_topMostRecord.Remove(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
- // if user happens to open context menu, we need to return back to query results before changing query
- App.API.BackToQueryResults();
App.API.ReQuery();
return false;
}
@@ -1285,8 +1283,6 @@ namespace Flow.Launcher.ViewModel
{
_topMostRecord.AddOrUpdate(result);
App.API.ShowMsg(InternationalizationManager.Instance.GetTranslation("success"));
- // if user happens to open context menu, we need to return back to query results before changing query
- App.API.BackToQueryResults();
App.API.ReQuery();
return false;
}
diff --git a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
index 7675ecb16..38b5bec65 100644
--- a/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
@@ -64,8 +64,6 @@ namespace Flow.Launcher.ViewModel
private void ShowCommandQuery(string action)
{
var actionKeyword = PluginManagerData.Metadata.ActionKeywords.Any() ? PluginManagerData.Metadata.ActionKeywords[0] + " " : String.Empty;
- // if user happens to open context menu, we need to return back to query results before changing query
- App.API.BackToQueryResults();
App.API.ChangeQuery($"{actionKeyword}{action} {_plugin.Name}");
App.API.ShowMainWindow();
}
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index c8601c431..447f06860 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -146,8 +146,6 @@ namespace Flow.Launcher.ViewModel
[RelayCommand]
private void OpenDeletePluginWindow()
{
- // if user happens to open context menu, we need to return back to query results before changing query
- PluginManager.API.BackToQueryResults();
PluginManager.API.ChangeQuery($"{PluginManagerActionKeyword} uninstall {PluginPair.Metadata.Name}".Trim(), true);
PluginManager.API.ShowMainWindow();
}
@@ -161,5 +159,4 @@ namespace Flow.Launcher.ViewModel
changeKeywordsWindow.ShowDialog();
}
}
-
}
diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs
index 6ba7047f2..c08853df8 100644
--- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs
@@ -264,7 +264,6 @@ namespace Flow.Launcher.Plugin.Program
Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_success"),
Context.API.GetTranslation(
"flowlauncher_plugin_program_disable_dlgtitle_success_message"));
- Context.API.BackToQueryResults();
Context.API.ReQuery();
return false;
},
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
index 86808cfbc..62076b494 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
@@ -382,7 +382,6 @@ namespace Flow.Launcher.Plugin.Shell
{
context.API.ShowMainWindow();
// if user happens to open context menu, we need to return back to query results before changing query
- context.API.BackToQueryResults();
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}");
});
From 6f55e8a35dbaf087a265dd2ff772a46d07b42996 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 22 Feb 2025 19:44:21 +0800
Subject: [PATCH 4/8] Add BackToQueryResults api function back
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 6 ++++++
Flow.Launcher/PublicAPIInstance.cs | 2 ++
Flow.Launcher/ViewModel/MainViewModel.cs | 2 +-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index 1a8da381b..28cc1fc91 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -305,6 +305,12 @@ namespace Flow.Launcher.Plugin
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);
+ ///
+ /// Back to the query results.
+ /// This method should run when selected item is from context menu or history.
+ ///
+ public void BackToQueryResults();
+
///
/// Displays a standardised Flow message box.
///
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index d7f052af3..7706a64ba 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -319,6 +319,8 @@ namespace Flow.Launcher
public void ReQuery(bool reselect = true) => _mainVM.ReQuery(reselect);
+ public void BackToQueryResults() => _mainVM.BackToQueryResults();
+
public MessageBoxResult ShowMsgBox(string messageBoxText, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage icon = MessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.OK) =>
MessageBoxEx.Show(messageBoxText, caption, button, icon, defaultResult);
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index d8e33ad14..0d1f5655b 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -489,7 +489,7 @@ namespace Flow.Launcher.ViewModel
}
}
- private void BackToQueryResults()
+ public void BackToQueryResults()
{
if (!SelectedIsFromQueryResults())
{
From a6f33401a36eac22a94e77604285259296853eb5 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 22 Feb 2025 19:45:43 +0800
Subject: [PATCH 5/8] Add BackToQueryResults in json prc api
---
.../Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs b/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
index a82cae5d2..e0a0434a2 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
@@ -170,5 +170,10 @@ namespace Flow.Launcher.Core.Plugin.JsonRPCV2Models
{
_api.OpenAppUri(appUri);
}
+
+ public void BackToQueryResults()
+ {
+ _api.BackToQueryResults();
+ }
}
}
From 64eb4a7bea6b10467d17fb5e4b623b9ba43dbfd7 Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Sat, 22 Feb 2025 19:48:25 +0800
Subject: [PATCH 6/8] Improve documents
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 4 ++--
Plugins/Flow.Launcher.Plugin.Shell/Main.cs | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index 28cc1fc91..9b608d14f 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -18,7 +18,7 @@ namespace Flow.Launcher.Plugin
{
///
/// Change Flow.Launcher query.
- /// When current results is from context menu or history, we will back to query results before changing query.
+ /// When current results are from context menu or history, we will back to query results before changing query.
///
/// query text
///
@@ -300,7 +300,7 @@ namespace Flow.Launcher.Plugin
///
/// Reloads the query.
- /// When current results is from context menu or history, we will back to query results before changing query.
+ /// When current results are from context menu or history, we will back to query results before requerying.
///
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);
diff --git a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
index 62076b494..53479b81f 100644
--- a/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Shell/Main.cs
@@ -381,7 +381,6 @@ namespace Flow.Launcher.Plugin.Shell
_ = Task.Run(() =>
{
context.API.ShowMainWindow();
- // if user happens to open context menu, we need to return back to query results before changing query
context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeparator}");
});
From 61cd5360283b2bcd3e4029d13a5c2d5eac4a00b8 Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Sat, 22 Feb 2025 23:16:20 +1100
Subject: [PATCH 7/8] Apply suggestions from code review
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index 9b608d14f..bf8bbf44a 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -300,7 +300,7 @@ namespace Flow.Launcher.Plugin
///
/// Reloads the query.
- /// When current results are from context menu or history, we will back to query results before requerying.
+ /// When current results are from context menu or history, it will go back to query results before requerying.
///
/// Choose the first result after reload if true; keep the last selected result if false. Default is true.
public void ReQuery(bool reselect = true);
From 0f82246683e30e62c3b6281da9f5ddf189e30103 Mon Sep 17 00:00:00 2001
From: Jack Ye <1160210343@qq.com>
Date: Sat, 22 Feb 2025 20:16:36 +0800
Subject: [PATCH 8/8] Update Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
Co-authored-by: Jeremy Wu
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index bf8bbf44a..07fc378c3 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -18,7 +18,7 @@ namespace Flow.Launcher.Plugin
{
///
/// Change Flow.Launcher query.
- /// When current results are from context menu or history, we will back to query results before changing query.
+ /// When current results are from context menu or history, it will go back to query results before changing query.
///
/// query text
///