diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..32135b2 --- /dev/null +++ b/404.html @@ -0,0 +1,426 @@ + + + +
+ + + + + + + + + + + + + +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!
+Using API requests in this way will cause your plugin to fail!
+from pyflowlauncher import Plugin, Result, send_results, api
+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",
+ JsonRPCAction=api.change_query("This is a new query!"),
+ )
+ return send_results([r])
+
+
+plugin.run()
+
+The example above will change the query in Flow Launcher when the user selects your result.
+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
+
+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 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()
+
+
+
+
+
+
+
+ Flow Launcher comes with a decent amount of icons that it uses throughout it's UI and plugins.
+You can use some of these icons in your plugin by importing from the icons
module.
Warning
+If PyFlowLauncher is unable to locate the Flow Launcher directory these icons may not be loaded!
+This will not crash your plugin but will leave the icon blank.
+from pyflowlauncher import Plugin, Result, send_results
+from pyflowlauncher.result import ResultResponse
+from pyflowlauncher.icons import ADMIN
+
+plugin = Plugin()
+
+
+@plugin.on_method
+def query(query: str) -> ResultResponse:
+ r = Result(
+ Title="This is a title!",
+ SubTitle="This is the subtitle!",
+ IcoPath=ADMIN
+ )
+ return send_results([r])
+
+
+plugin.run()
+
+
+
+
+
+
+
+ pyFlowLauncher is an API that allows you to quickly create plugins for Flow Launcher!
+Install via pip:
+python -m pip install pyflowlauncher[all]
+
+++⚠️ The
+[all]
is important if you intend to support Python older then3.11
. ⚠️
A basic plugin using a function as the query method.
+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()
+
+A more advanced usage using a Method
class as the query method.
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()
+
+
+
+
+
+
+
+ module-attribute
+
+
+NAME_SPACE = 'Flow.Launcher'
+
change_query(query: str, requery: bool = False) -> JsonRPCAction
+
Change the query in Flow Launcher.
+ +pyflowlauncher/api.py
12 +13 +14 |
|
close_app() -> JsonRPCAction
+
Close Flow Launcher.
+ +pyflowlauncher/api.py
22 +23 +24 |
|
copy_to_clipboard(text: str, direct_copy: bool = False, show_default_notification=True) -> JsonRPCAction
+
Copy text to the clipboard.
+ +pyflowlauncher/api.py
62 +63 +64 |
|
hide_app() -> JsonRPCAction
+
Hide Flow Launcher.
+ +pyflowlauncher/api.py
27 +28 +29 |
|
open_directory(directory_path: str, filename_or_filepath: Optional[str] = None) -> JsonRPCAction
+
Open a directory.
+ +pyflowlauncher/api.py
67 +68 +69 |
|
open_setting_dialog() -> JsonRPCAction
+
Open the settings window in Flow Launcher.
+ +pyflowlauncher/api.py
42 +43 +44 |
|
open_uri(uri: str) -> JsonRPCAction
+
Open a URI.
+ +pyflowlauncher/api.py
77 +78 +79 |
|
open_url(url: str, in_private: bool = False) -> JsonRPCAction
+
Open a URL.
+ +pyflowlauncher/api.py
72 +73 +74 |
|
reload_plugins() -> JsonRPCAction
+
Reload the plugins in Flow Launcher.
+ +pyflowlauncher/api.py
57 +58 +59 |
|
shell_run(command: str, filename: str = 'cmd.exe') -> JsonRPCAction
+
Run a shell command.
+ +pyflowlauncher/api.py
17 +18 +19 |
|
show_app() -> JsonRPCAction
+
Show Flow Launcher.
+ +pyflowlauncher/api.py
32 +33 +34 |
|
show_msg(title: str, sub_title: str, ico_path: str = '') -> JsonRPCAction
+
Show a message in Flow Launcher.
+ +pyflowlauncher/api.py
37 +38 +39 |
|
start_loading_bar() -> JsonRPCAction
+
Start the loading bar in Flow Launcher.
+ +pyflowlauncher/api.py
47 +48 +49 |
|
stop_loading_bar() -> JsonRPCAction
+
Stop the loading bar in Flow Launcher.
+ +pyflowlauncher/api.py
52 +53 +54 |
|
pyflowlauncher/event.py
6 + 7 + 8 + 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 |
|
__call__(method, *args, **kwargs)
+
pyflowlauncher/event.py
22 +23 +24 +25 +26 +27 +28 +29 |
|
__init__()
+
pyflowlauncher/event.py
8 + 9 +10 |
|
add_exception_handler(exception: Exception, handler: Callable[..., Any])
+
pyflowlauncher/event.py
19 +20 |
|
add_method(method, *, name=None)
+
pyflowlauncher/event.py
12 +13 |
|
add_methods(methods)
+
pyflowlauncher/event.py
15 +16 +17 |
|
handler: python +options: +separate_signature: true +show_signature_annotations: true
+ + + + + + +pyflowlauncher/plugin.py
19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 |
|
property
+
+
+run_dir: Path
+
Return the run directory of the plugin.
+property
+
+
+settings: dict
+
__init__(methods: list[Method] | None = None) -> None
+
pyflowlauncher/plugin.py
21 +22 +23 +24 +25 +26 +27 |
|
add_exception_handler(exception: Exception, handler: Callable[..., Any]) -> None
+
Add exception handler to be called when an exception is raised in a method.
+ +pyflowlauncher/plugin.py
49 +50 +51 |
|
add_method(method: Method) -> None
+
Add a method to the event handler.
+ +pyflowlauncher/plugin.py
29 +30 +31 +32 +33 |
|
add_methods(methods: Iterable[Method]) -> None
+
pyflowlauncher/plugin.py
35 +36 |
|
manifest() -> PluginManifestSchema
+
Return the plugin manifest.
+ +pyflowlauncher/plugin.py
84 +85 +86 +87 +88 |
|
method(method: Method) -> Method
+
Register a method to be called when the plugin is run.
+ +pyflowlauncher/plugin.py
45 +46 +47 |
|
on_method(method: Method) -> Method
+
pyflowlauncher/plugin.py
38 +39 +40 +41 +42 +43 |
|
root_dir() -> Path
+
Return the root directory of the plugin.
+ +pyflowlauncher/plugin.py
75 +76 +77 +78 +79 +80 +81 +82 |
|
run() -> None
+
pyflowlauncher/plugin.py
60 +61 +62 +63 +64 +65 +66 +67 +68 |
|
+ Bases: TypedDict
Flow Launcher Glyph
+ +pyflowlauncher/result.py
25 +26 +27 +28 |
|
instance-attribute
+
+
+FontFamily: str
+
instance-attribute
+
+
+Glyph: str
+
+ Bases: TypedDict
Flow Launcher JsonRPCAction
+ +pyflowlauncher/result.py
18 +19 +20 +21 +22 |
|
instance-attribute
+
+
+dontHideAfterAction: NotRequired[bool]
+
instance-attribute
+
+
+method: str
+
instance-attribute
+
+
+parameters: Iterable
+
dataclass
+
+
+pyflowlauncher/result.py
31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 |
|
class-attribute
+ instance-attribute
+
+
+AutoCompleteText: Optional[str] = None
+
class-attribute
+ instance-attribute
+
+
+ContextData: Optional[Iterable] = None
+
class-attribute
+ instance-attribute
+
+
+CopyText: Optional[str] = None
+
class-attribute
+ instance-attribute
+
+
+Glyph: Optional[Glyph] = None
+
class-attribute
+ instance-attribute
+
+
+IcoPath: Optional[Union[str, Path]] = None
+
class-attribute
+ instance-attribute
+
+
+JsonRPCAction: Optional[JsonRPCAction] = None
+
class-attribute
+ instance-attribute
+
+
+RoundedIcon: bool = False
+
class-attribute
+ instance-attribute
+
+
+Score: int = 0
+
class-attribute
+ instance-attribute
+
+
+SubTitle: Optional[str] = None
+
instance-attribute
+
+
+Title: str
+
add_action(method: Method, parameters: Optional[Iterable[Any]] = None, *, dont_hide_after_action: bool = False) -> None
+
pyflowlauncher/result.py
47 +48 +49 +50 +51 +52 +53 +54 +55 |
|
as_dict() -> Dict[str, Any]
+
pyflowlauncher/result.py
44 +45 |
|
+ Bases: TypedDict
pyflowlauncher/result.py
58 +59 +60 |
|
instance-attribute
+
+
+SettingsChange: NotRequired[Optional[Dict[str, Any]]]
+
instance-attribute
+
+
+result: List[Dict[str, Any]]
+
send_results(results: Iterable[Result], settings: Optional[Dict[str, Any]] = None) -> ResultResponse
+
Formats and returns results as a JsonRPCResponse
+ +pyflowlauncher/result.py
63 +64 +65 |
|