Skip to content

Commit 4360c77

Browse files
authored
Merge branch 'dev' into dev
2 parents 9d04745 + a48f060 commit 4360c77

File tree

14 files changed

+168
-41
lines changed

14 files changed

+168
-41
lines changed

Flow.Launcher.Plugin/ActionContext.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,47 @@
22

33
namespace Flow.Launcher.Plugin
44
{
5+
/// <summary>
6+
/// Context provided as a parameter when invoking a
7+
/// <see cref="Result.Action"/> or <see cref="Result.AsyncAction"/>
8+
/// </summary>
59
public class ActionContext
610
{
11+
/// <summary>
12+
/// Contains the press state of certain special keys.
13+
/// </summary>
714
public SpecialKeyState SpecialKeyState { get; set; }
815
}
916

17+
/// <summary>
18+
/// Contains the press state of certain special keys.
19+
/// </summary>
1020
public class SpecialKeyState
1121
{
22+
/// <summary>
23+
/// True if the Ctrl key is pressed.
24+
/// </summary>
1225
public bool CtrlPressed { get; set; }
26+
27+
/// <summary>
28+
/// True if the Shift key is pressed.
29+
/// </summary>
1330
public bool ShiftPressed { get; set; }
31+
32+
/// <summary>
33+
/// True if the Alt key is pressed.
34+
/// </summary>
1435
public bool AltPressed { get; set; }
36+
37+
/// <summary>
38+
/// True if the Windows key is pressed.
39+
/// </summary>
1540
public bool WinPressed { get; set; }
1641

42+
/// <summary>
43+
/// Get this object represented as a <see cref="ModifierKeys"/> flag combination.
44+
/// </summary>
45+
/// <returns></returns>
1746
public ModifierKeys ToModifierKeys()
1847
{
1948
return (CtrlPressed ? ModifierKeys.Control : ModifierKeys.None) |

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<PackageTags>flowlauncher</PackageTags>
2727
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2828
<PublishRepositoryUrl>true</PublishRepositoryUrl>
29+
<PackageReadmeFile>Readme.md</PackageReadmeFile>
2930
</PropertyGroup>
3031

3132
<PropertyGroup Condition="'$(APPVEYOR)' == 'True'">
@@ -56,7 +57,7 @@
5657
</PropertyGroup>
5758

5859
<ItemGroup>
59-
<None Include="README.md" />
60+
<None Include="Readme.md" Pack="true" PackagePath="\"/>
6061
<None Include="FodyWeavers.xml" />
6162
</ItemGroup>
6263

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22

33
namespace Flow.Launcher.Plugin
44
{
5+
/// <summary>
6+
/// Adds support for presenting additional options for a given <see cref="Result"/> from a context menu.
7+
/// </summary>
58
public interface IContextMenu : IFeatures
69
{
10+
/// <summary>
11+
/// Load context menu items for the given result.
12+
/// </summary>
13+
/// <param name="selectedResult">
14+
/// The <see cref="Result"/> for which the user has activated the context menu.
15+
/// </param>
716
List<Result> LoadContextMenus(Result selectedResult);
817
}
918
}

Flow.Launcher.Plugin/Interfaces/IPluginI18n.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Globalization;
1+
using System.Globalization;
22

33
namespace Flow.Launcher.Plugin
44
{
@@ -7,8 +7,14 @@ namespace Flow.Launcher.Plugin
77
/// </summary>
88
public interface IPluginI18n : IFeatures
99
{
10+
/// <summary>
11+
/// Get a localised version of the plugin's title
12+
/// </summary>
1013
string GetTranslatedPluginTitle();
1114

15+
/// <summary>
16+
/// Get a localised version of the plugin's description
17+
/// </summary>
1218
string GetTranslatedPluginDescription();
1319

1420
/// <summary>
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
namespace Flow.Launcher.Plugin
1+
namespace Flow.Launcher.Plugin
22
{
33
/// <summary>
4-
/// Save addtional plugin data. Inherit this interface if additional data e.g. cache needs to be saved,
5-
/// Otherwise if LoadSettingJsonStorage or SaveSettingJsonStorage has been callded,
6-
/// plugin settings will be automatically saved (see Flow.Launcher/PublicAPIInstance.SavePluginSettings) by Flow
4+
/// Inherit this interface if additional data e.g. cache needs to be saved.
75
/// </summary>
6+
/// <remarks>
7+
/// For storing plugin settings, prefer <see cref="IPublicAPI.LoadSettingJsonStorage{T}"/>
8+
/// or <see cref="IPublicAPI.SaveSettingJsonStorage{T}"/>.
9+
/// Once called, your settings will be automatically saved by Flow.
10+
/// </remarks>
811
public interface ISavable : IFeatures
912
{
13+
/// <summary>
14+
/// Save additional plugin data, such as cache.
15+
/// </summary>
1016
void Save();
1117
}
1218
}

Flow.Launcher.Plugin/PluginInitContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace Flow.Launcher.Plugin
22
{
3+
/// <summary>
4+
/// Carries data passed to a plugin when it gets initialized.
5+
/// </summary>
36
public class PluginInitContext
47
{
58
public PluginInitContext()
@@ -12,6 +15,9 @@ public PluginInitContext(PluginMetadata currentPluginMetadata, IPublicAPI api)
1215
API = api;
1316
}
1417

18+
/// <summary>
19+
/// The metadata of the plugin being initialized.
20+
/// </summary>
1521
public PluginMetadata CurrentPluginMetadata { get; internal set; }
1622

1723
/// <summary>

Flow.Launcher.Plugin/Query.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ public Query(string rawQuery, string search, string[] terms, string[] searchTerm
3636
/// <summary>
3737
/// Search part of a query.
3838
/// This will not include action keyword if exclusive plugin gets it, otherwise it should be same as RawQuery.
39-
/// Since we allow user to switch a exclusive plugin to generic plugin,
39+
/// Since we allow user to switch a exclusive plugin to generic plugin,
4040
/// so this property will always give you the "real" query part of the query
4141
/// </summary>
4242
public string Search { get; internal init; }
4343

4444
/// <summary>
4545
/// The search string split into a string array.
46+
/// Does not include the <see cref="ActionKeyword"/>.
4647
/// </summary>
4748
public string[] SearchTerms { get; init; }
4849

@@ -59,6 +60,7 @@ public Query(string rawQuery, string search, string[] terms, string[] searchTerm
5960

6061
[Obsolete("Typo")]
6162
public const string TermSeperater = TermSeparator;
63+
6264
/// <summary>
6365
/// User can set multiple action keywords seperated by ';'
6466
/// </summary>
@@ -69,15 +71,22 @@ public Query(string rawQuery, string search, string[] terms, string[] searchTerm
6971

7072

7173
/// <summary>
72-
/// '*' is used for System Plugin
74+
/// Wildcard action keyword. Plugins using this value will be queried on every search.
7375
/// </summary>
7476
public const string GlobalPluginWildcardSign = "*";
7577

78+
/// <summary>
79+
/// The action keyword part of this query.
80+
/// For global plugins this value will be empty.
81+
/// </summary>
7682
public string ActionKeyword { get; init; }
7783

7884
/// <summary>
79-
/// Return first search split by space if it has
85+
/// Splits <see cref="SearchTerms"/> by spaces and returns the first item.
8086
/// </summary>
87+
/// <remarks>
88+
/// returns an empty string when <see cref="SearchTerms"/> does not have enough items.
89+
/// </remarks>
8190
public string FirstSearch => SplitSearch(0);
8291

8392
private string _secondToEndSearch;
@@ -88,20 +97,27 @@ public Query(string rawQuery, string search, string[] terms, string[] searchTerm
8897
public string SecondToEndSearch => SearchTerms.Length > 1 ? (_secondToEndSearch ??= string.Join(' ', SearchTerms[1..])) : "";
8998

9099
/// <summary>
91-
/// Return second search split by space if it has
100+
/// Splits <see cref="SearchTerms"/> by spaces and returns the second item.
92101
/// </summary>
102+
/// <remarks>
103+
/// returns an empty string when <see cref="SearchTerms"/> does not have enough items.
104+
/// </remarks>
93105
public string SecondSearch => SplitSearch(1);
94106

95107
/// <summary>
96-
/// Return third search split by space if it has
108+
/// Splits <see cref="SearchTerms"/> by spaces and returns the third item.
97109
/// </summary>
110+
/// <remarks>
111+
/// returns an empty string when <see cref="SearchTerms"/> does not have enough items.
112+
/// </remarks>
98113
public string ThirdSearch => SplitSearch(2);
99114

100115
private string SplitSearch(int index)
101116
{
102117
return index < SearchTerms.Length ? SearchTerms[index] : string.Empty;
103118
}
104119

120+
/// <inheritdoc />
105121
public override string ToString() => RawQuery;
106122
}
107123
}

Flow.Launcher.Plugin/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
What does Flow.Launcher.Plugin do?
2-
====
1+
Reference this package to develop a plugin for [Flow Launcher](https://github.com/Flow-Launcher/Flow.Launcher).
32

4-
* Defines base objects and interfaces for plugins
5-
* Plugin authors making C# plugins should reference this DLL via nuget
6-
* Contains commands and models that can be used by plugins
3+
Useful links:
4+
5+
* [General plugin development guide](https://www.flowlauncher.com/docs/#/plugin-dev)
6+
* [.Net plugin development guide](https://www.flowlauncher.com/docs/#/develop-dotnet-plugins)
7+
* [Package API Reference](https://www.flowlauncher.com/docs/#/API-Reference/Flow.Launcher.Plugin)

0 commit comments

Comments
 (0)