From a13ab1af61c90eb1e4b7d0af28d4694c982b6db2 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Fri, 17 Nov 2023 03:58:42 -0500 Subject: [PATCH] Fix formatting issues --- docs/guide/API Requests.md | 79 ++++++++++++++++++------------------ docs/guide/Launcher_Icons.md | 34 ++++++++-------- docs/index.md | 2 +- docs/reference/api.md | 4 +- docs/reference/event.md | 11 ++--- docs/reference/plugin.md | 2 +- docs/reference/result.md | 4 +- 7 files changed, 69 insertions(+), 67 deletions(-) diff --git a/docs/guide/API Requests.md b/docs/guide/API Requests.md index f0acd61..b45e067 100644 --- a/docs/guide/API Requests.md +++ b/docs/guide/API Requests.md @@ -1,66 +1,65 @@ -## Sending API requests to FLow Launcher +# Sending API requests to FLow Launcher You can send special requests to Flow Launcher to control the launcher from your plugin. This communication is currently only one way. !!! warning - You can not send API requests from a query or context_menu method! - + You can not send API requests from a query or context_menu method! + Using API requests in this way will cause your plugin to fail! -### Sending a command from a Result +## Sending a command from a Result -``` -from pyflowlauncher import Plugin, Result, send_results, api -from pyflowlauncher.result import JsonRPCAction, ResultResponse + ```py + from pyflowlauncher import Plugin, Result, send_results, api + from pyflowlauncher.result import JsonRPCAction, ResultResponse -plugin = Plugin() + 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", - JsonRPCAction=api.change_query("This is a new query!"), - ) - return send_results([r]) + @plugin.on_method + def query(query: str) -> ResultResponse: + r = Result( + Title="This is a title!", + SubTitle="This is the subtitle!", + IcoPath="icon.png", + JsonRPCAction=api.change_query("This is a new query!"), + ) + return send_results([r]) -plugin.run() -``` + plugin.run() + ``` The example above will change the query in Flow Launcher when the user selects your result. - -### Sending a command from a Method +## Sending a command from a Method You can also send an API request in a custom method like so: -``` -from pyflowlauncher import Plugin, Result, send_results, api -from pyflowlauncher.result import JsonRPCAction, ResultResponse + ```py + from pyflowlauncher import Plugin, Result, send_results, api + from pyflowlauncher.result import JsonRPCAction, ResultResponse -plugin = Plugin() + plugin = Plugin() -@plugin._on_method -def example_method() -> JsonRPCAction: - # Do stuff here - return api.change_query("This is also a new query!") + @plugin._on_method + def example_method() -> JsonRPCAction: + # Do stuff here + return api.change_query("This is also a new query!") -@plugin.on_method -def query(query: str) -> ResultResponse: - r = Result( - Title="This is a title!", - SubTitle="This is the subtitle!", - IcoPath="icon.png", - ) - r.add_action(example_method) - return send_results([r]) + @plugin.on_method + def query(query: str) -> ResultResponse: + r = Result( + Title="This is a title!", + SubTitle="This is the subtitle!", + IcoPath="icon.png", + ) + r.add_action(example_method) + return send_results([r]) -plugin.run() -``` \ No newline at end of file + plugin.run() + ``` diff --git a/docs/guide/Launcher_Icons.md b/docs/guide/Launcher_Icons.md index b58020a..2c24909 100644 --- a/docs/guide/Launcher_Icons.md +++ b/docs/guide/Launcher_Icons.md @@ -1,4 +1,4 @@ -## Using icons included with Flow Launcher +# Using icons included with Flow Launcher Flow Launcher comes with a decent amount of icons that it uses throughout it's UI and plugins. @@ -10,25 +10,25 @@ You can use some of these icons in your plugin by importing from the `icons` mod This will not crash your plugin but will leave the icon blank. -### Example: +## Example -``` -from pyflowlauncher import Plugin, Result, send_results -from pyflowlauncher.result import ResultResponse -from pyflowlauncher.icons import ICONS + ``` + from pyflowlauncher import Plugin, Result, send_results + from pyflowlauncher.result import ResultResponse + from pyflowlauncher.icons import ICONS -plugin = Plugin() + plugin = Plugin() -@plugin.on_method -def query(query: str) -> ResultResponse: - r = Result( - Title="This is a title!", - SubTitle="This is the subtitle!", - IcoPath=ICONS["app"] - ) - return send_results([r]) + @plugin.on_method + def query(query: str) -> ResultResponse: + r = Result( + Title="This is a title!", + SubTitle="This is the subtitle!", + IcoPath=ICONS["app"] + ) + return send_results([r]) -plugin.run() -``` \ No newline at end of file + plugin.run() + ``` diff --git a/docs/index.md b/docs/index.md index 80254a7..dcdaac9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,3 @@ # Home -{!README.md!} \ No newline at end of file +{!README.md!} diff --git a/docs/reference/api.md b/docs/reference/api.md index f036ce6..5e193bf 100644 --- a/docs/reference/api.md +++ b/docs/reference/api.md @@ -1,3 +1,3 @@ -## API Reference +# API Reference -::: pyflowlauncher.api \ No newline at end of file +::: pyflowlauncher.api diff --git a/docs/reference/event.md b/docs/reference/event.md index 0151632..ff19600 100644 --- a/docs/reference/event.md +++ b/docs/reference/event.md @@ -1,6 +1,7 @@ +# event + ::: pyflowlauncher.event - handler: python - options: - separate_signature: true - show_signature_annotations: true - \ No newline at end of file +handler: python +options: +separate_signature: true +show_signature_annotations: true diff --git a/docs/reference/plugin.md b/docs/reference/plugin.md index c6d4e0e..69499ca 100644 --- a/docs/reference/plugin.md +++ b/docs/reference/plugin.md @@ -1,3 +1,3 @@ -## Plugin Reference +# Plugin Reference ::: pyflowlauncher.plugin.Plugin diff --git a/docs/reference/result.md b/docs/reference/result.md index 8285ee5..d5e9ce1 100644 --- a/docs/reference/result.md +++ b/docs/reference/result.md @@ -1 +1,3 @@ -::: pyflowlauncher.result \ No newline at end of file +# result + +::: pyflowlauncher.result