diff --git a/src/cthulhu/cthulhu.py b/src/cthulhu/cthulhu.py index 28025f9..e9507fd 100644 --- a/src/cthulhu/cthulhu.py +++ b/src/cthulhu/cthulhu.py @@ -665,7 +665,7 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False): _eventManager.activate() cthulhuApp.getSignalManager().emitSignal('load-setting-begin') - cthulhuApp.getPluginSystemManager().register_plugin_keybindings_with_active_script() + # cthulhuApp.getPluginSystemManager().register_plugin_keybindings_with_active_script() cthulhuApp.getSignalManager().emitSignal('load-setting-completed') diff --git a/src/cthulhu/event_manager.py b/src/cthulhu/event_manager.py index 2e43e21..cf35061 100644 --- a/src/cthulhu/event_manager.py +++ b/src/cthulhu/event_manager.py @@ -118,7 +118,7 @@ class EventManager: if hasattr(cthulhu, 'cthulhuApp') and cthulhu.cthulhuApp: plugin_manager = cthulhu.cthulhuApp.getPluginSystemManager() if plugin_manager: - plugin_manager.register_plugin_keybindings_with_active_script() + # plugin_manager.register_plugin_keybindings_with_active_script() def activateLegacyKeyHandling(self): if not self.legacyKeyHandlingActive: diff --git a/src/cthulhu/script_manager.py b/src/cthulhu/script_manager.py index 92fb5fc..e5daeb9 100644 --- a/src/cthulhu/script_manager.py +++ b/src/cthulhu/script_manager.py @@ -323,7 +323,7 @@ class ScriptManager: from . import cthulhu plugin_manager = cthulhu.cthulhuApp.getPluginSystemManager() if plugin_manager: - plugin_manager.register_plugin_keybindings_with_active_script() + # plugin_manager.register_plugin_keybindings_with_active_script() tokens = ["SCRIPT MANAGER: Setting active script to", newScript, "reason:", reason] debug.printTokens(debug.LEVEL_INFO, tokens, True) diff --git a/src/cthulhu/scripts/default.py b/src/cthulhu/scripts/default.py index 2b119fa..a0cca9a 100644 --- a/src/cthulhu/scripts/default.py +++ b/src/cthulhu/scripts/default.py @@ -407,6 +407,24 @@ class Script(script.Script): for keyBinding in bindings.keyBindings: keyBindings.add(keyBinding) + # Add plugin keybindings from APIHelper storage + try: + import cthulhu.cthulhu as cthulhu + api_helper = cthulhu.getCthulhu() + if api_helper and hasattr(api_helper, '_gestureBindings'): + with open('/tmp/extension_bindings_debug.log', 'a') as f: + f.write(f"=== Adding plugin bindings in getExtensionBindings() ===\n") + f.write(f"Available contexts: {list(api_helper._gestureBindings.keys())}\n") + + for context_name, context_bindings in api_helper._gestureBindings.items(): + for binding in context_bindings: + keyBindings.add(binding) + with open('/tmp/extension_bindings_debug.log', 'a') as f: + f.write(f"Added plugin binding: {binding.keysymstring} modifiers={binding.modifiers} desc={binding.handler.description}\n") + except Exception as e: + import cthulhu.debug as debug + debug.printMessage(debug.LEVEL_WARNING, f"Failed to add plugin bindings: {e}", True) + return keyBindings def getKeyBindings(self):