From cb894cbea66ee0e1da4191a844aac2797fc97dd1 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Sat, 27 May 2023 18:46:03 +0800
Subject: [PATCH 1/2] Add GetLastQueryMode API
---
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 6 ++++++
Flow.Launcher/PublicAPIInstance.cs | 5 +++++
Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs | 12 +++++++++---
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index d0fdf136b68..9d872214f8d 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -270,5 +270,11 @@ public interface IPublicAPI
/// Non-C# plugins should use this method
///
public void OpenAppUri(string appUri);
+
+ ///
+ /// Get Settings.LastQueryMode
+ /// Possible return values: "Empty", "Selcted", "Preserved"
+ ///
+ public string GetLastQueryMode();
}
}
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index 800115bfae9..d5aaff36ebc 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -275,6 +275,11 @@ public void OpenAppUri(Uri appUri)
public void RegisterGlobalKeyboardCallback(Func callback) => _globalKeyboardHandlers.Add(callback);
public void RemoveGlobalKeyboardCallback(Func callback) => _globalKeyboardHandlers.Remove(callback);
+ public string GetLastQueryMode()
+ {
+ return _settingsVM.Settings.LastQueryMode.ToString();
+ }
+
#endregion
#region Private Methods
diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs
index 3eff7e3984d..9f761a5a972 100644
--- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs
@@ -65,7 +65,7 @@ private List CreateResultsFromQuery(Query query)
{
string termToSearch = query.Search;
var processlist = processHelper.GetMatchingProcesses(termToSearch);
-
+
if (!processlist.Any())
{
return null;
@@ -89,7 +89,10 @@ private List CreateResultsFromQuery(Query query)
Action = (c) =>
{
processHelper.TryKill(p);
- _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
+ if (_context.API.GetLastQueryMode() != "Empty")
+ {
+ _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
+ }
return true;
}
});
@@ -114,7 +117,10 @@ private List CreateResultsFromQuery(Query query)
{
processHelper.TryKill(p.Process);
}
- _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
+ if (_context.API.GetLastQueryMode() != "Empty")
+ {
+ _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
+ }
return true;
}
});
From 2b5cd922e8df5ff3589e39fc24a97146571b1b51 Mon Sep 17 00:00:00 2001
From: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Sat, 27 May 2023 19:31:35 +0800
Subject: [PATCH 2/2] Fix typo
---
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 9d872214f8d..ad0bebb4b00 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -273,7 +273,7 @@ public interface IPublicAPI
///
/// Get Settings.LastQueryMode
- /// Possible return values: "Empty", "Selcted", "Preserved"
+ /// Possible return values: "Empty", "Selected", "Preserved"
///
public string GetLastQueryMode();
}