diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Images/copylink.png b/Plugins/Flow.Launcher.Plugin.WebSearch/Images/copylink.png new file mode 100644 index 00000000000..3218c94c9a0 Binary files /dev/null and b/Plugins/Flow.Launcher.Plugin.WebSearch/Images/copylink.png differ diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml index db42aa7fcf0..72f618f551f 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml @@ -31,7 +31,8 @@ Thus, the generic formula for a search on Netflix is https://www.netflix.com/search?q={q} - + Copy URL + Copy search URL to clipboard Title diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/ru.xaml b/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/ru.xaml index a2ec9405a16..b8757f67b1a 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/ru.xaml +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Languages/ru.xaml @@ -29,7 +29,8 @@ Thus, the generic formula for a search on Netflix is https://www.netflix.com/search?q={q} - + Скопировать URL-адрес + Скопировать URL поиска в буфер обмена Title diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs index 39aa1738fca..bf5fadc5451 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs @@ -11,7 +11,7 @@ namespace Flow.Launcher.Plugin.WebSearch { - public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated + public class Main : IAsyncPlugin, ISettingProvider, IPluginI18n, IResultUpdated, IContextMenu { private PluginInitContext _context; @@ -76,7 +76,8 @@ public async Task> QueryAsync(Query query, CancellationToken token) _context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))); return true; - } + }, + ContextData = searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword)), }; results.Add(result); @@ -139,11 +140,31 @@ private async Task> SuggestionsAsync(string keyword, string _context.API.OpenUrl(searchSource.Url.Replace("{q}", Uri.EscapeDataString(o))); return true; - } + }, + ContextData = searchSource.Url.Replace("{q}", Uri.EscapeDataString(o)), }); return resultsFromSuggestion; } + public List LoadContextMenus(Result selected) + { + if (selected?.ContextData == null || selected.ContextData is not string) return new List(); + return new List() { + new Result + { + Title = _context.API.GetTranslation("flowlauncher_plugin_websearch_copyurl_title"), + SubTitle = _context.API.GetTranslation("flowlauncher_plugin_websearch_copyurl_subtitle"), + IcoPath = "Images/copylink.png", + Action = c => + { + _context.API.CopyToClipboard(selected.ContextData as string); + + return true; + } + }, + }; + } + public Task InitAsync(PluginInitContext context) { return Task.Run(Init);