diff --git a/Wox.Plugin.SystemPlugins/UrlPlugin.cs b/Wox.Plugin.SystemPlugins/UrlPlugin.cs new file mode 100644 index 0000000000..70ac428df0 --- /dev/null +++ b/Wox.Plugin.SystemPlugins/UrlPlugin.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Wox.Plugin.SystemPlugins +{ + public class UrlPlugin : BaseSystemPlugin + { + protected override List QueryInternal(Query query) + { + var raw = query.RawQuery; + Uri uri; + if (Uri.TryCreate(raw, UriKind.Absolute, out uri)) + { + return new List + { + new Result + { + Title = raw, + SubTitle = "Open the typed URL...", + IcoPath = "Images/url1.png", + Score = 8, + Action = _ => + { + Process.Start(raw); + return true; + } + } + }; + } + return new List(0); + } + + public override string Name { get { return "URL handler"; } } + public override string Description { get { return "Open the typed URL..."; } } + public override string IcoPath { get { return "Images/url2.png"; } } + + protected override void InitInternal(PluginInitContext context) + { + } + } +} \ No newline at end of file diff --git a/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj b/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj index 89b0103ed7..44c51eae6d 100644 --- a/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj +++ b/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj @@ -73,6 +73,7 @@ + WebSearchesSetting.xaml diff --git a/Wox/Images/url1.png b/Wox/Images/url1.png new file mode 100644 index 0000000000..3b86b637da Binary files /dev/null and b/Wox/Images/url1.png differ diff --git a/Wox/Images/url2.png b/Wox/Images/url2.png new file mode 100644 index 0000000000..44883fd1c2 Binary files /dev/null and b/Wox/Images/url2.png differ