Skip to content

Commit

Permalink
Merge pull request #78 from Yusyuriv/main
Browse files Browse the repository at this point in the history
A lot of small fixes
  • Loading branch information
onesounds authored May 23, 2024
2 parents efcd618 + 7b5b5a3 commit 80f4c80
Show file tree
Hide file tree
Showing 23 changed files with 177 additions and 180 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Welcome

Here you will find documentation on usage tips, design information, plugin development and more.
Here you will find documentation on usage tips, design information, plugin development, and more.

If you have just started using Flow, please head over to the [Usage Tips](/usage-tips.md) section to find out how you can get the most out of Flow. Otherwise if you are completely new to Flow and want to find out its features and give it a spin, please visit [here](https://github.com/Flow-Launcher/Flow.Launcher/#-features).
If you have just started using Flow, please head over to the [Usage Tips](/usage-tips.md) section to find out how you can get the most out of Flow. Otherwise, if you are completely new to Flow and want to find out its features and give it a spin, please visit [here](https://github.com/Flow-Launcher/Flow.Launcher/#-features).
12 changes: 7 additions & 5 deletions _coverpage.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<p align="center">
<a href="https://flow-launcher.github.io">
<img width="250px" src="https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher/5ba4514f31e624c679628d4dfe89036c0e24006c/Doc/Logo/resources/flow-header-square-transparent.png">
</a>
</p>
<a href="https://www.flowlauncher.com/">
<img
width="250"
src="https://cdn.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher@5ba4514f31e624c679628d4dfe89036c0e24006c/Doc/Logo/resources/flow-header-square-transparent.png"
alt="Flow Launcher logo"
>
</a>

# Flow Launcher

Expand Down
6 changes: 3 additions & 3 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
- [**Plugin references**](/nodejs-plugin-references.md)
- Testing Plugins
- [**Testing Guide**](/testing.md)
- JSONRPC
- [**JSON RPC Introduction**](/json-rpc.md)
- [**JSON RPC Plugin Settings**](/json-rpc-settings.md)
- JSON-RPC
- [**Introduction**](/json-rpc.md)
- [**Plugin Settings**](/json-rpc-settings.md)
- [**Visual SettingsTemplate.yaml editor**](/json-rpc-visual-settingstemplate-editor.md)
- Porting Plugins
- [**Porting Plugins Guide**](/port-plugins.md)
Expand Down
5 changes: 2 additions & 3 deletions bookmark-custom-locations.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Custom location list

This page contains the information for setting custom browser locations for the Bookmark plugin that are not included by default.
- These locations may not be the exact path, but they are the typical bookmark location for each browser, you can use them as a reference guide.
- If you are using a browser that is not listed here, please update this document. It will help others.
- These locations may not be the exact path, but they are the typical bookmark location for each browser; you can use them as a reference guide.
- If you are using a browser not listed here, please update this document. It will help others.

----

Expand All @@ -14,4 +14,3 @@ This page contains the information for setting custom browser locations for the
**LibreWolf**
- Firefox Engine
- C:\Users\username\AppData\RoamingRoaming\librewolf\Profiles\1tyx98jn.default-default

36 changes: 18 additions & 18 deletions develop-dotnet-plugins.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
Flow is written in C#, so plugins written in .Net platform can directly communicate with Flow without extra protocols.
Flow is written in C#, so plugins written in .NET platform can directly communicate with Flow without extra protocols.

## Initialization

For C# Plugins, We recommend you use the [dotnet template](https://github.com/Flow-Launcher/dotnet-template) to generate a plugin template.

In order to be recognized as a Flow DotNet plugin, the directory needs to have at least two files
1. [`plugin.json`](plugin.json.md)
2. A Dotnet Assembly that implements **[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)** or **[IAsyncPlugin](API-Reference/Flow.Launcher.Plugin/iasyncplugin.md)** (remember to reference [Flow.Launcher.Plugin](https://www.nuget.org/packages/Flow.Launcher.Plugin/) by Nuget). The plugin template will add the reference and create a `Main.cs` that implements `IPlugin`.
To be recognized as a Flow DotNet plugin, the directory needs to have at least two files
1. [`plugin.json`](/plugin.json.md)
2. A Dotnet Assembly that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** (remember to reference [Flow.Launcher.Plugin](https://www.nuget.org/packages/Flow.Launcher.Plugin/) by Nuget). The plugin template will add the reference and create a `Main.cs` that implements `IPlugin`.

Find our API Reference [here](API-Reference/)
Find our API Reference [here](/API-Reference/Flow.Launcher.Plugin.md)


A sample CSharp Plugin [here](https://github.com/Flow-Launcher/plugin-samples)

## IPlugin/IAsyncPlugin

The `Main`class that implements **[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)** or **[IAsyncPlugin](API-Reference/Flow.Launcher.Plugin/iasyncplugin.md)** will handle the query search with Flow.
The `Main`class that implements **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** or **[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** will handle the query search with Flow.

**[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)** interface contains two required methods:
**[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)** interface contains two required methods:
1. `void Init(PluginInitContext context)`
- [PluginInitContext](https://github.com/Flow-Launcher/Flow.Launcher/blob/master/API-Reference/Flow.Launcher.Plugin/PluginInitContext.cs) exposes some API from Flow and an metadata object for your plugin.
- [PluginInitContext](/API-Reference/Flow.Launcher.Plugin/PluginInitContext.md) exposes some API from Flow and a metadata object for your plugin.
- It will be invoked before the invocation of `Query`, so you can do some preparation here.
- We recommend you do expensive operations in this method instead of Object Constructor because this method will be executed in parallel with other plugins.
2. `List<Result> Query(Query query)`
- `Query` will be invoked when user activate this plugin with specific ActionKeyword.
- A `List` of [Result](/API-Reference/Flow.Launcher.Plugin/result.md) object should be returned.
- `Query` will be invoked when user activates this plugin with specific ActionKeyword.
- A `List` of [Result](/API-Reference/Flow.Launcher.Plugin/Result.md) object should be returned.

**[IAsyncPlugin](API-Reference/Flow.Launcher.Plugin/iasyncplugin.md)** is the async version of **[IPlugin](API-Reference/Flow.Launcher.Plugin/iplugin.md)**
**[IAsyncPlugin](/API-Reference/Flow.Launcher.Plugin/IAsyncPlugin.md)** is the async version of **[IPlugin](/API-Reference/Flow.Launcher.Plugin/IPlugin.md)**
- Instead of implementing `Init` and `Query`, you will need to implement `InitAsync`and `QueryAsync`, which use `Task`,`Task<List<Result>` as return value to allow using `async/await` strategy
- `QueryAsync` provides a `CancellationToken token` to allow you to check whether user has typed a new query.


## Additional interfaces

Besides the basic implementation of **IPlugin/IAsyncPlugin**, plugins can also implement a series of interfaces that belongs to **IFeatures** to control more communication with Flow.
Besides the basic implementation of **IPlugin/IAsyncPlugin**, plugins can also implement a series of interfaces that belong to **IFeatures** to control more communication with Flow.

**Remarks**: You should implement these interfaces in the same class that implements **IPlugin/IAsyncPlugin**.

### [IContextMenu](API-Reference/Flow.Launcher.Plugin/icontextmenu.md)
### [IContextMenu](/API-Reference/Flow.Launcher.Plugin/IContextMenu.md)

`LoadContextMenus` will be invoked when users expand the context menu of a specific Result.
The return value of `LoadContextMenus` is similar to Results from `Query/QueryAsync`.

### [IReloadable](API-Reference/Flow.Launcher.Plugin/ireloadable.md)/[IAsyncReloadable](API-Reference/Flow.Launcher.Plugin/iasyncreloadable.md)
### [IReloadable](/API-Reference/Flow.Launcher.Plugin/IReloadable.md)/[IAsyncReloadable](API-Reference/Flow.Launcher.Plugin/IAsyncReloadable.md)

`ReloadData/ReloadDataAsync` will be invoked when users click the `Reload Plugin Data` command from _sys_ plugin. Generally, it is used to reload some cache (such as the programs information cached in _Program_ plugin).

### [IPluginI18n](/API-Reference/Flow.Launcher.Plugin/iplugini18n.md)
### [IPluginI18n](/API-Reference/Flow.Launcher.Plugin/IPluginI18n.md)

**IPluginI18n** means the plugin has been internationalized. Therefore, Flow will load the additional language resources from `/Languages` when loading the plugin.
By implementing this interface with additional language files, Flow will be able to load plugin-specific localized language resources. You will be able to get the translated text with `IPublicAPI.GetTranslation(string key)`.
Expand All @@ -60,13 +60,13 @@ The Language Resource file will need to be a list of **key/value** pair. Follow

Plugins are required to implement **IPublicI18n** to let Flow load Language resources.

### [IResultUpdated](API-Reference/Flow.Launcher.Plugin/iresultupdated.md)
### [IResultUpdated](/API-Reference/Flow.Launcher.Plugin/IResultUpdated.md)


Implementing **IResultUpdated** provides a way to return part of the query results early. This is generally useful for plugins with long running queries.
Implementing **IResultUpdated** provides a way to return part of the query results early. This is generally useful for plugins with long-running queries.

To early return a result to Flow, you will need to invoke `ResultUpdated` event with an `ResultUpdatedEventArgs`, which includes the current `Query` object and the List of `Result` objects similar to the return value in `Query(Async)`.

### [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable) *Flow 1.8.0 or higher*

Implementing **IDisposable** to dispose unmanaged resource in the plugin. `Dispose()` will be called when Flow exit.
Implementing **IDisposable** to dispose unmanaged resource in the plugin. `Dispose()` will be called when Flow exit.
Loading

0 comments on commit 80f4c80

Please sign in to comment.