summaryrefslogtreecommitdiff
path: root/src/plugin_lifecycle.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugin_lifecycle.py')
-rw-r--r--src/plugin_lifecycle.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/plugin_lifecycle.py b/src/plugin_lifecycle.py
new file mode 100644
index 0000000..4fb5c69
--- /dev/null
+++ b/src/plugin_lifecycle.py
@@ -0,0 +1,47 @@
+import os
+import decky
+from .services import InstallationService
+
+
+class PluginLifecycleManager:
+ """Manages plugin lifecycle events"""
+
+ def __init__(self):
+ self.installation_service = InstallationService()
+
+ async def on_load(self):
+ """Called when plugin is loaded"""
+ decky.logger.info("Lossless Scaling loaded!")
+
+ async def on_unload(self):
+ """Called when plugin is unloaded"""
+ decky.logger.info("Lossless Scaling unloading")
+
+ async def on_uninstall(self):
+ """Called when plugin is uninstalled"""
+ decky.logger.info("Lossless Scaling uninstalled - starting cleanup")
+
+ # Clean up lsfg-vk files when the plugin is uninstalled
+ self.installation_service.cleanup_on_uninstall()
+
+ decky.logger.info("Lossless Scaling uninstall cleanup completed")
+
+ async def on_migration(self):
+ """Called during plugin migration"""
+ decky.logger.info("Migrating")
+ # Here's a migration example for logs:
+ # - `~/.config/decky-template/template.log` will be migrated to `decky.decky_LOG_DIR/template.log`
+ decky.migrate_logs(os.path.join(decky.DECKY_USER_HOME,
+ ".config", "decky-template", "template.log"))
+ # Here's a migration example for settings:
+ # - `~/homebrew/settings/template.json` is migrated to `decky.decky_SETTINGS_DIR/template.json`
+ # - `~/.config/decky-template/` all files and directories under this root are migrated to `decky.decky_SETTINGS_DIR/`
+ decky.migrate_settings(
+ os.path.join(decky.DECKY_HOME, "settings", "template.json"),
+ os.path.join(decky.DECKY_USER_HOME, ".config", "decky-template"))
+ # Here's a migration example for runtime data:
+ # - `~/homebrew/template/` all files and directories under this root are migrated to `decky.decky_RUNTIME_DIR/`
+ # - `~/.local/share/decky-template/` all files and directories under this root are migrated to `decky.decky_RUNTIME_DIR/`
+ decky.migrate_runtime(
+ os.path.join(decky.DECKY_HOME, "template"),
+ os.path.join(decky.DECKY_USER_HOME, ".local", "share", "decky-template"))