mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #372 from Flow-Launcher/change_websearch_default
Change WebSearch default to global
This commit is contained in:
commit
f927702f99
4 changed files with 18 additions and 7 deletions
|
|
@ -25,6 +25,10 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
internal static string DefaultImagesDirectory;
|
internal static string DefaultImagesDirectory;
|
||||||
internal static string CustomImagesDirectory;
|
internal static string CustomImagesDirectory;
|
||||||
|
|
||||||
|
private readonly int scoreStandard = 50;
|
||||||
|
|
||||||
|
private readonly int scoreSuggestions = 48;
|
||||||
|
|
||||||
private readonly string SearchSourceGlobalPluginWildCardSign = "*";
|
private readonly string SearchSourceGlobalPluginWildCardSign = "*";
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
|
|
@ -49,13 +53,17 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
var title = keyword;
|
var title = keyword;
|
||||||
string subtitle = _context.API.GetTranslation("flowlauncher_plugin_websearch_search") + " " + searchSource.Title;
|
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))
|
if (string.IsNullOrEmpty(keyword))
|
||||||
{
|
{
|
||||||
var result = new Result
|
var result = new Result
|
||||||
{
|
{
|
||||||
Title = subtitle,
|
Title = subtitle,
|
||||||
SubTitle = string.Empty,
|
SubTitle = string.Empty,
|
||||||
IcoPath = searchSource.IconPath
|
IcoPath = searchSource.IconPath,
|
||||||
|
Score = score
|
||||||
};
|
};
|
||||||
results.Add(result);
|
results.Add(result);
|
||||||
}
|
}
|
||||||
|
|
@ -65,9 +73,9 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
SubTitle = subtitle,
|
SubTitle = subtitle,
|
||||||
Score = 6,
|
|
||||||
IcoPath = searchSource.IconPath,
|
IcoPath = searchSource.IconPath,
|
||||||
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
|
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
|
||||||
|
Score = score,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
if (_settings.OpenInNewBrowser)
|
if (_settings.OpenInNewBrowser)
|
||||||
|
|
@ -123,6 +131,9 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
var source = _settings.SelectedSuggestion;
|
var source = _settings.SelectedSuggestion;
|
||||||
if (source != null)
|
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);
|
var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false);
|
||||||
|
|
||||||
token.ThrowIfCancellationRequested();
|
token.ThrowIfCancellationRequested();
|
||||||
|
|
@ -131,7 +142,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
Title = o,
|
Title = o,
|
||||||
SubTitle = subtitle,
|
SubTitle = subtitle,
|
||||||
Score = 5,
|
Score = score,
|
||||||
IcoPath = searchSource.IconPath,
|
IcoPath = searchSource.IconPath,
|
||||||
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
|
ActionKeywordAssigned = searchSource.ActionKeyword == SearchSourceGlobalPluginWildCardSign ? string.Empty : searchSource.ActionKeyword,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
new SearchSource
|
new SearchSource
|
||||||
{
|
{
|
||||||
Title = "Google",
|
Title = "Google",
|
||||||
ActionKeyword = "g",
|
ActionKeyword = "*",
|
||||||
Icon = "google.png",
|
Icon = "google.png",
|
||||||
Url = "https://www.google.com/search?q={q}",
|
Url = "https://www.google.com/search?q={q}",
|
||||||
Enabled = true
|
Enabled = true
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"ID": "565B73353DBF4806919830B9202EE3BF",
|
"ID": "565B73353DBF4806919830B9202EE3BF",
|
||||||
"ActionKeywords": [
|
"ActionKeywords": [
|
||||||
"g",
|
"*",
|
||||||
"wiki",
|
"wiki",
|
||||||
"findicon",
|
"findicon",
|
||||||
"facebook",
|
"facebook",
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
"Name": "Web Searches",
|
"Name": "Web Searches",
|
||||||
"Description": "Provide the web search ability",
|
"Description": "Provide the web search ability",
|
||||||
"Author": "qianlifeng",
|
"Author": "qianlifeng",
|
||||||
"Version": "1.3.4",
|
"Version": "1.3.5",
|
||||||
"Language": "csharp",
|
"Language": "csharp",
|
||||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||||
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",
|
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"WebSearches": [
|
"WebSearches": [
|
||||||
{
|
{
|
||||||
"Title": "Google",
|
"Title": "Google",
|
||||||
"ActionKeyword": "g",
|
"ActionKeyword": "*",
|
||||||
"IconPath": "Images\\google.png",
|
"IconPath": "Images\\google.png",
|
||||||
"Url": "https://www.google.com/search?q={q}",
|
"Url": "https://www.google.com/search?q={q}",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue