blob: 4fb5c696682d3b51afa46289481c969bb8da9296 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
|
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"))
|