feat: prioritize script activation using compositor context

This commit is contained in:
2026-04-09 09:31:24 -04:00
parent 309822a0ca
commit 8fc77c5a2f
2 changed files with 51 additions and 0 deletions
+12
View File
@@ -1236,6 +1236,12 @@ class EventManager:
if not script:
return False, "There is no script for this event."
prioritizedContextToken = self._prioritizedContextToken or cthulhu_state.prioritizedDesktopContextToken
if self._churnSuppressed and prioritizedContextToken:
eventToken = self._context_token_for_event(event)
if eventToken not in (None, prioritizedContextToken):
return False, "Event context does not match compositor-prioritized context."
if script == cthulhu_state.activeScript:
return False, "The script for this event is already active."
@@ -1588,6 +1594,12 @@ class EventManager:
msg = f"EVENT MANAGER: Exception processing {event.type}: {error}"
debug.printMessage(debug.LEVEL_INFO, msg, True)
debug.printException(debug.LEVEL_INFO)
else:
if self._compositorStateAdapter is not None:
if eType.startswith("window:activate") or (
eType.startswith("object:state-changed:focused") and event.detail1
):
self._compositorStateAdapter.sync_accessible_context(event.type)
tokens = ["EVENT MANAGER: locusOfFocus:", cthulhu_state.locusOfFocus,
"activeScript:", cthulhu_state.activeScript]