diff options
| author | marios <marios8543@gmail.com> | 2025-10-06 23:38:14 +0300 |
|---|---|---|
| committer | marios <marios8543@gmail.com> | 2025-10-06 23:38:14 +0300 |
| commit | c3c0e87c6fc94cfd753ea45d623849e1b3633316 (patch) | |
| tree | b9a33589f948d7de59232192e12ecf16aecf1f6c /backend/decky_loader/utilities.py | |
| parent | 86b5567d4eac84399245c9a71270d6142ee54ded (diff) | |
| download | decky-loader-c3c0e87c6fc94cfd753ea45d623849e1b3633316.tar.gz decky-loader-c3c0e87c6fc94cfd753ea45d623849e1b3633316.zip | |
plugin disable boilerplate / untested
Diffstat (limited to 'backend/decky_loader/utilities.py')
| -rw-r--r-- | backend/decky_loader/utilities.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/backend/decky_loader/utilities.py b/backend/decky_loader/utilities.py index 69c69fe6..ab2dde6f 100644 --- a/backend/decky_loader/utilities.py +++ b/backend/decky_loader/utilities.py @@ -390,7 +390,6 @@ class Utilities: "total": len(all), } - # Based on https://stackoverflow.com/a/46422554/13174603 def start_rdt_proxy(self, ip: str, port: int): async def pipe(reader: StreamReader, writer: StreamWriter): @@ -474,3 +473,22 @@ class Utilities: async def get_tab_id(self, name: str): return (await get_tab(name)).id + + async def disable_plugin(self, name: str): + disabled_plugins: List[str] = await self.get_setting("disabled_plugins", []) + if name not in disabled_plugins: + disabled_plugins.append(name) + await self.set_setting("disabled_plugins", disabled_plugins) + + await self.context.plugin_loader.plugins[name].stop() + await self.context.ws.emit("loader/unload_plugin", name) + + async def enable_plugin(self, name: str): + disabled_plugins: List[str] = await self.get_setting("disabled_plugins", []) + if name in disabled_plugins: + disabled_plugins.remove(name) + await self.set_setting("disabled_plugins", disabled_plugins) + + plugin = self.context.plugin_loader.plugins[name] + plugin.start() + await self.context.plugin_loader.dispatch_plugin(plugin.name, plugin.version, plugin.load_type) |
