Skip to content

Commit 1238d86

Browse files
committed
add HelloWorldFSharp example plugin
1 parent 032a203 commit 1238d86

File tree

4 files changed

+86
-0
lines changed

4 files changed

+86
-0
lines changed

Flow.Launcher.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Browse
7474
EndProject
7575
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Calculator", "Plugins\Flow.Launcher.Plugin.Calculator\Flow.Launcher.Plugin.Calculator.csproj", "{59BD9891-3837-438A-958D-ADC7F91F6F7E}"
7676
EndProject
77+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "HelloWorldFSharp", "Plugins\HelloWorldFSharp\HelloWorldFSharp.fsproj", "{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}"
78+
EndProject
7779
Global
7880
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7981
Debug|Any CPU = Debug|Any CPU
@@ -313,6 +315,18 @@ Global
313315
{59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|x64.Build.0 = Release|Any CPU
314316
{59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|x86.ActiveCfg = Release|Any CPU
315317
{59BD9891-3837-438A-958D-ADC7F91F6F7E}.Release|x86.Build.0 = Release|Any CPU
318+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
319+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
320+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Debug|x64.ActiveCfg = Debug|Any CPU
321+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Debug|x64.Build.0 = Debug|Any CPU
322+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Debug|x86.ActiveCfg = Debug|Any CPU
323+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Debug|x86.Build.0 = Debug|Any CPU
324+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
325+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Release|Any CPU.Build.0 = Release|Any CPU
326+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Release|x64.ActiveCfg = Release|Any CPU
327+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Release|x64.Build.0 = Release|Any CPU
328+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Release|x86.ActiveCfg = Release|Any CPU
329+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E}.Release|x86.Build.0 = Release|Any CPU
316330
EndGlobalSection
317331
GlobalSection(SolutionProperties) = preSolution
318332
HideSolutionNode = FALSE
@@ -332,6 +346,7 @@ Global
332346
{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
333347
{9B130CC5-14FB-41FF-B310-0A95B6894C37} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
334348
{59BD9891-3837-438A-958D-ADC7F91F6F7E} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
349+
{30DDA7D9-3712-44F4-BD18-DC1C05B2DD9E} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
335350
EndGlobalSection
336351
GlobalSection(ExtensibilityGlobals) = postSolution
337352
SolutionGuid = {F26ACB50-3F6C-4907-B0C9-1ADACC1D0DED}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
6+
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
7+
</PropertyGroup>
8+
9+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
10+
<OutputPath>..\..\Output\Debug\Plugins\HelloWorldFSharp\</OutputPath>
11+
<DefineConstants>DEBUG;TRACE</DefineConstants>
12+
</PropertyGroup>
13+
14+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
15+
<OutputPath>..\..\Output\Release\Plugins\HelloWorldFSharp\</OutputPath>
16+
</PropertyGroup>
17+
18+
<ItemGroup>
19+
<Content Include="plugin.json">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</Content>
22+
<Compile Include="Main.fs" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
27+
</ItemGroup>
28+
29+
</Project>

Plugins/HelloWorldFSharp/Main.fs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace HelloWorldFSharp
2+
3+
open Flow.Launcher.Plugin
4+
open System.Collections.Generic
5+
6+
type HelloWorldFSharpPlugin() =
7+
8+
let mutable initContext = PluginInitContext()
9+
10+
interface IPlugin with
11+
member this.Init (context: PluginInitContext) =
12+
initContext <- context
13+
14+
member this.Query (query: Query) =
15+
List<Result> [
16+
Result (Title = "Hello World from F#",
17+
SubTitle = sprintf "Query: %s" query.Search)
18+
19+
Result (Title = "Browse source code of this plugin",
20+
SubTitle = "click to open in browser",
21+
Action = (fun ctx ->
22+
initContext.CurrentPluginMetadata.Website
23+
|> System.Diagnostics.Process.Start
24+
|> ignore
25+
true))
26+
27+
Result (Title = "Trigger a tray message",
28+
Action = (fun _ ->
29+
initContext.API.ShowMsg ("Sample tray message", "from the F# plugin")
30+
false))
31+
]

Plugins/HelloWorldFSharp/plugin.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"ID":"8FF5D5C1F8194958A12E8668FB7ECC04",
3+
"ActionKeyword":"hf",
4+
"Name":"Hello World FSharp",
5+
"Description":"Hello World FSharp",
6+
"Author":"Ioannis G.",
7+
"Version":"1.0.0",
8+
"Language":"fsharp",
9+
"Website":"https://github.com/Flow-Launcher/Flow.Launcher",
10+
"ExecuteFileName":"HelloWorldFSharp.dll"
11+
}

0 commit comments

Comments
 (0)