diff --git a/src/cthulhu/plugins/PluginManager/plugin.py b/src/cthulhu/plugins/PluginManager/plugin.py index f336471..cb913cd 100644 --- a/src/cthulhu/plugins/PluginManager/plugin.py +++ b/src/cthulhu/plugins/PluginManager/plugin.py @@ -458,19 +458,34 @@ class PluginManager(Plugin): active_plugins.remove(plugin_name) _settingsManager.setSetting('activePlugins', active_plugins) + if hasattr(_settingsManager, "general") and isinstance(_settingsManager.general, dict): + _settingsManager.general['activePlugins'] = active_plugins try: - current_general = _settingsManager.getGeneralSettings() + active_profile = _settingsManager.getSetting('activeProfile') + if isinstance(active_profile, (list, tuple)) and len(active_profile) > 1: + profile_name = active_profile[1] + else: + profile_name = _settingsManager.profile or 'default' + + current_general = _settingsManager.getGeneralSettings(profile_name) or {} current_general['activePlugins'] = active_plugins + _settingsManager.profile = profile_name + _settingsManager._setProfileGeneral(current_general) + + pronunciations = _settingsManager.getPronunciations(profile_name) or {} + keybindings = _settingsManager.getKeybindings(profile_name) or {} + backend = _settingsManager._backend if backend: - backend.saveDefaultSettings( - current_general, - _settingsManager.getPronunciations(), - _settingsManager.getKeybindings() + backend.saveProfileSettings( + profile_name, + _settingsManager.profileGeneral, + pronunciations, + keybindings ) - debug.printMessage(debug.LEVEL_INFO, "PluginManager: Settings saved to backend", True) + debug.printMessage(debug.LEVEL_INFO, f"PluginManager: Settings saved to backend (profile {profile_name})", True) else: debug.printMessage(debug.LEVEL_INFO, "PluginManager: No backend available for saving", True)