https://github.com/garulf/pyflowlauncher
Python JSON-RPC library for Flow Launcher plugins.
https://github.com/garulf/pyflowlauncher
flow-launcher flow-launcher-plugins
Last synced: over 1 year ago
JSON representation
Python JSON-RPC library for Flow Launcher plugins.
- Host: GitHub
- URL: https://github.com/garulf/pyflowlauncher
- Owner: Garulf
- License: mit
- Created: 2023-11-10T01:37:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T16:37:50.000Z (over 2 years ago)
- Last Synced: 2024-05-01T18:08:37.769Z (about 2 years ago)
- Topics: flow-launcher, flow-launcher-plugins
- Language: Python
- Homepage: https://garulf.github.io/pyFlowLauncher/
- Size: 715 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/Garulf/pyFlowLauncher/actions/workflows/tests.yaml)
[](https://github.com/Garulf/pyFlowLauncher/actions/workflows/docs.yaml)
[](https://github.com/Garulf/pyFlowLauncher/actions/workflows/create_release.yaml)
[](https://pypi.org/project/pyflowlauncher/)
[](https://pypi.org/project/pyflowlauncher/)
[](./LICENSE)
[](https://www.buymeacoffee.com/garulf)
# pyFlowLauncher
pyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
## Installation
Install via pip:
```py
python -m pip install pyflowlauncher[all]
```
> [!IMPORTANT]
> Please use the `[all]` flag in order to support Python versions older then `3.11`.
## Usage
### Basic plugin
A basic plugin using a function as the query method.
```py
from pyflowlauncher import Plugin, Result, send_results
from pyflowlauncher.result import ResultResponse
plugin = Plugin()
@plugin.on_method
def query(query: str) -> ResultResponse:
r = Result(
Title="This is a title!",
SubTitle="This is the subtitle!",
IcoPath="icon.png"
)
return send_results([r])
plugin.run()
```
### Advanced plugin
A more advanced usage using a `Method` class as the query method.
```py
from pyflowlauncher import Plugin, Result, Method
from pyflowlauncher.result import ResultResponse
plugin = Plugin()
class Query(Method):
def __call__(self, query: str) -> ResultResponse:
r = Result(
Title="This is a title!",
SubTitle="This is the subtitle!"
)
self.add_result(r)
return self.return_results()
plugin.add_method(Query())
plugin.run()
```