mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
URL plugin
This commit is contained in:
parent
33d7e40e7c
commit
be25226172
4 changed files with 43 additions and 0 deletions
42
Wox.Plugin.SystemPlugins/UrlPlugin.cs
Normal file
42
Wox.Plugin.SystemPlugins/UrlPlugin.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Wox.Plugin.SystemPlugins
|
||||
{
|
||||
public class UrlPlugin : BaseSystemPlugin
|
||||
{
|
||||
protected override List<Result> QueryInternal(Query query)
|
||||
{
|
||||
var raw = query.RawQuery;
|
||||
Uri uri;
|
||||
if (Uri.TryCreate(raw, UriKind.Absolute, out uri))
|
||||
{
|
||||
return new List<Result>
|
||||
{
|
||||
new Result
|
||||
{
|
||||
Title = raw,
|
||||
SubTitle = "Open the typed URL...",
|
||||
IcoPath = "Images/url1.png",
|
||||
Score = 8,
|
||||
Action = _ =>
|
||||
{
|
||||
Process.Start(raw);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
return new List<Result>(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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,6 +73,7 @@
|
|||
<Compile Include="Calculator.cs" />
|
||||
<Compile Include="Program\ProgramSources\FileSystemProgramSource.cs" />
|
||||
<Compile Include="Program\ProgramSources\UserStartMenuProgramSource.cs" />
|
||||
<Compile Include="UrlPlugin.cs" />
|
||||
<Compile Include="WebSearch\WebSearchesSetting.xaml.cs">
|
||||
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
|||
BIN
Wox/Images/url1.png
Normal file
BIN
Wox/Images/url1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Wox/Images/url2.png
Normal file
BIN
Wox/Images/url2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Loading…
Reference in a new issue