From 7ef3b0d93850f3b6d126656240c513d0c92420e6 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 1 Mar 2021 07:44:45 +1100 Subject: [PATCH 1/3] change WebSearch default to global --- Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs | 2 +- Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json | 2 +- Plugins/Flow.Launcher.Plugin.WebSearch/setting.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs index 8a1700415..33c304375 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs @@ -21,7 +21,7 @@ namespace Flow.Launcher.Plugin.WebSearch new SearchSource { Title = "Google", - ActionKeyword = "g", + ActionKeyword = "*", Icon = "google.png", Url = "https://www.google.com/search?q={q}", Enabled = true diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json index e9f237a58..d397379d8 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json @@ -1,7 +1,7 @@ { "ID": "565B73353DBF4806919830B9202EE3BF", "ActionKeywords": [ - "g", + "*", "wiki", "findicon", "facebook", diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json b/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json index c31d02ae6..ef9c63d67 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json @@ -2,7 +2,7 @@ "WebSearches": [ { "Title": "Google", - "ActionKeyword": "g", + "ActionKeyword": "*", "IconPath": "Images\\google.png", "Url": "https://www.google.com/search?q={q}", "Enabled": true From 901d508722cac60d2a5931f270f7df75a58c3bbe Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 1 Mar 2021 07:51:46 +1100 Subject: [PATCH 2/3] version bump WebSearch --- Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json index d397379d8..c7c1e1591 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json @@ -25,7 +25,7 @@ "Name": "Web Searches", "Description": "Provide the web search ability", "Author": "qianlifeng", - "Version": "1.3.4", + "Version": "1.3.5", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll", From ab8a850349be0e0a2a205a92caea507761e68d63 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 1 Mar 2021 20:28:05 +1100 Subject: [PATCH 3/3] action keyword results appear above global action keyword results --- Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs index 7eca5a568..5235f3fbe 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs @@ -25,6 +25,10 @@ namespace Flow.Launcher.Plugin.WebSearch internal static string DefaultImagesDirectory; internal static string CustomImagesDirectory; + private readonly int scoreStandard = 50; + + private readonly int scoreSuggestions = 48; + private readonly string SearchSourceGlobalPluginWildCardSign = "*"; public void Save() @@ -49,13 +53,17 @@ namespace Flow.Launcher.Plugin.WebSearch var title = keyword; string subtitle = _context.API.GetTranslation("flowlauncher_plugin_websearch_search") + " " + searchSource.Title; + //Action Keyword match apear on top + var score = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? scoreStandard : scoreStandard + 1; + if (string.IsNullOrEmpty(keyword)) { var result = new Result { Title = subtitle, SubTitle = string.Empty, - IcoPath = searchSource.IconPath + IcoPath = searchSource.IconPath, + Score = score }; results.Add(result); } @@ -65,9 +73,9 @@ namespace Flow.Launcher.Plugin.WebSearch { Title = title, SubTitle = subtitle, - Score = 6, IcoPath = searchSource.IconPath, ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword, + Score = score, Action = c => { if (_settings.OpenInNewBrowser) @@ -123,6 +131,9 @@ namespace Flow.Launcher.Plugin.WebSearch var source = _settings.SelectedSuggestion; if (source != null) { + //Suggestions appear below actual result, and appear above global action keyword match if non-global; + var score = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? scoreSuggestions : scoreSuggestions + 1; + var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false); token.ThrowIfCancellationRequested(); @@ -131,7 +142,7 @@ namespace Flow.Launcher.Plugin.WebSearch { Title = o, SubTitle = subtitle, - Score = 5, + Score = score, IcoPath = searchSource.IconPath, ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword, Action = c =>