Skip to content

Commit

Permalink
Fix indentation level on code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Garulf committed Jan 8, 2024
1 parent 96fe1c6 commit cf216db
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
60 changes: 30 additions & 30 deletions docs/guide/API Requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ You can send special requests to Flow Launcher to control the launcher from your
## Sending a command from a Result

```py
from pyflowlauncher import Plugin, Result, send_results, api
from pyflowlauncher.result import JsonRPCAction, ResultResponse
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.
Expand All @@ -38,28 +38,28 @@ The example above will change the query in Flow Launcher when the user selects y
You can also send an API request in a custom method like so:

```py
from pyflowlauncher import Plugin, Result, send_results, api
from pyflowlauncher.result import JsonRPCAction, ResultResponse
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()
plugin.run()
```
26 changes: 13 additions & 13 deletions docs/guide/Launcher_Icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ You can use some of these icons in your plugin by importing from the `icons` mod
## Example

```py
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()
plugin.run()
```

0 comments on commit cf216db

Please sign in to comment.