more work on keybindings.

This commit is contained in:
Storm Dragon 2025-06-05 13:27:25 -04:00
parent 2eb6d3c7dd
commit a1d90a7245
4 changed files with 21 additions and 3 deletions

View File

@ -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')

View File

@ -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:

View File

@ -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)

View File

@ -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):