From f7b1190f9563e188fa4d733f1fa7d9b6c0b1c3cc Mon Sep 17 00:00:00 2001
From: Jack251970 <1160210343@qq.com>
Date: Wed, 26 Feb 2025 22:03:26 +0800
Subject: [PATCH] Add global search panel
---
Flow.Launcher/ActionKeywords.xaml.cs | 18 ++-
Flow.Launcher/Languages/en.xaml | 1 +
.../InstalledPluginDisplayKeyword.xaml | 106 ++++++++++++------
Flow.Launcher/ViewModel/PluginViewModel.cs | 17 +++
4 files changed, 105 insertions(+), 37 deletions(-)
diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs
index 80a4abef1..4b678f42d 100644
--- a/Flow.Launcher/ActionKeywords.xaml.cs
+++ b/Flow.Launcher/ActionKeywords.xaml.cs
@@ -77,11 +77,25 @@ namespace Flow.Launcher
{
foreach (var actionKeyword in removedActionKeywords)
{
- App.API.RemoveActionKeyword(id, actionKeyword);
+ if (actionKeyword == Query.GlobalPluginWildcardSign)
+ {
+ pluginViewModel.GlobalSearch = false;
+ }
+ else
+ {
+ App.API.RemoveActionKeyword(id, actionKeyword);
+ }
}
foreach (var actionKeyword in addedActionKeywords)
{
- App.API.AddActionKeyword(id, actionKeyword);
+ if (actionKeyword == Query.GlobalPluginWildcardSign)
+ {
+ pluginViewModel.GlobalSearch = true;
+ }
+ else
+ {
+ App.API.AddActionKeyword(id, actionKeyword);
+ }
}
// Update action keywords text and close window
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index b1575b252..f2eeb2de5 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -114,6 +114,7 @@
Off
Action keyword Setting
Action keyword
+ Global search
Current action keyword
New action keyword
Change Action Keywords
diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplayKeyword.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplayKeyword.xaml
index ff2f14c4b..197e9ddef 100644
--- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplayKeyword.xaml
+++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplayKeyword.xaml
@@ -4,44 +4,80 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:viewModel="clr-namespace:Flow.Launcher.ViewModel"
d:DataContext="{d:DesignInstance viewModel:PluginViewModel}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs
index 9b717216a..026e9965b 100644
--- a/Flow.Launcher/ViewModel/PluginViewModel.cs
+++ b/Flow.Launcher/ViewModel/PluginViewModel.cs
@@ -105,6 +105,23 @@ namespace Flow.Launcher.ViewModel
public string Version => InternationalizationManager.Instance.GetTranslation("plugin_query_version") + " " + PluginPair.Metadata.Version;
public string InitAndQueryTime => InternationalizationManager.Instance.GetTranslation("plugin_init_time") + " " + PluginPair.Metadata.InitTime + "ms, " + InternationalizationManager.Instance.GetTranslation("plugin_query_time") + " " + PluginPair.Metadata.AvgQueryTime + "ms";
public string ActionKeywordsText => string.Join(Query.ActionKeywordSeparator, PluginPair.Metadata.ActionKeywords);
+ public bool GlobalSearch
+ {
+ get => PluginPair.Metadata.ActionKeywords.Contains(Query.GlobalPluginWildcardSign);
+ set
+ {
+ if (value)
+ {
+ App.API.AddActionKeyword(PluginPair.Metadata.ID, Query.GlobalPluginWildcardSign);
+ }
+ else
+ {
+ App.API.RemoveActionKeyword(PluginPair.Metadata.ID, Query.GlobalPluginWildcardSign);
+ }
+ OnPropertyChanged();
+ OnActionKeywordsChanged();
+ }
+ }
public int Priority => PluginPair.Metadata.Priority;
public Infrastructure.UserSettings.Plugin PluginSettingsObject { get; set; }