Changes to the plugin manager.
This commit is contained in:
parent
48d99e8813
commit
90aecf8055
@ -170,6 +170,33 @@ class PluginSystemManager:
|
||||
active_script = cthulhu_state.activeScript
|
||||
logger.info(f"Registering plugin keybindings with active script: {active_script}")
|
||||
|
||||
# First, register keybindings from APIHelper's stored bindings
|
||||
# This is where plugin keybindings actually get stored
|
||||
from . import cthulhu
|
||||
api_helper = cthulhu.cthulhuApp.getAPIHelper()
|
||||
if api_helper and hasattr(api_helper, '_gestureBindings'):
|
||||
logger.info("Registering stored gesture bindings from APIHelper")
|
||||
for context_name, bindings_list in api_helper._gestureBindings.items():
|
||||
logger.info(f"Processing context '{context_name}' with {len(bindings_list)} bindings")
|
||||
for binding in bindings_list:
|
||||
logger.info(f"Adding stored binding: {binding.keysymstring} with modifiers {binding.modifiers}")
|
||||
# Check if binding already exists to avoid duplicates
|
||||
if not active_script.getKeyBindings().hasKeyBinding(binding, "keysNoMask"):
|
||||
active_script.getKeyBindings().add(binding)
|
||||
# Force recalculation of keycode if it wasn't set when device was None
|
||||
if not binding.keycode and binding.keysymstring:
|
||||
from . import keybindings
|
||||
binding.keycode = keybindings.getKeycode(binding.keysymstring)
|
||||
# Register key grab at system level - this was missing!
|
||||
grab_ids = cthulhu.addKeyGrab(binding)
|
||||
if grab_ids:
|
||||
binding._grab_ids = grab_ids
|
||||
else:
|
||||
logger.warning(f"Failed to create key grab for {binding.keysymstring} - device may not be available")
|
||||
else:
|
||||
logger.info(f"Binding already exists: {binding.keysymstring}")
|
||||
|
||||
# Also check the old method for any plugins that use get_bindings()
|
||||
for pluginInfo in self._plugins.values():
|
||||
if not pluginInfo.loaded or not pluginInfo.instance:
|
||||
continue
|
||||
@ -190,7 +217,6 @@ class PluginSystemManager:
|
||||
from . import keybindings
|
||||
binding.keycode = keybindings.getKeycode(binding.keysymstring)
|
||||
# Register key grab at system level - this was missing!
|
||||
from . import cthulhu
|
||||
grab_ids = cthulhu.addKeyGrab(binding)
|
||||
if grab_ids:
|
||||
binding._grab_ids = grab_ids
|
||||
|
Loading…
x
Reference in New Issue
Block a user