mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-11 18:32:12 +02:00
Fix action triggering by using kitten output instead of remote control
The RC approach sent actions targeting the overlay window itself rather than the underlying window. Switch to the standard kitten output pattern: the Go kitten outputs the selected action definition via KittenOutputSerializer, and handle_result in Python calls boss.combine() with the correct target window after the overlay closes.
This commit is contained in:
@@ -57,6 +57,7 @@ def collect_keys_data(opts: Any) -> dict[str, Any]:
|
||||
'key': key_repr,
|
||||
'action': action_name,
|
||||
'action_display': action_repr,
|
||||
'definition': d.definition or action_name,
|
||||
'help': help_text,
|
||||
'long_help': long_help,
|
||||
})
|
||||
@@ -98,13 +99,11 @@ def main(args: list[str]) -> None:
|
||||
raise SystemExit('This must be run as kitten command-palette')
|
||||
|
||||
|
||||
main.allow_remote_control = True # type: ignore[attr-defined]
|
||||
main.remote_control_password = True # type: ignore[attr-defined]
|
||||
|
||||
|
||||
@result_handler(has_ready_notification=True)
|
||||
def handle_result(args: list[str], data: dict[str, Any], target_window_id: int, boss: BossType) -> None:
|
||||
pass
|
||||
if data and 'action' in data:
|
||||
w = boss.window_id_map.get(target_window_id)
|
||||
boss.combine(data['action'], w)
|
||||
|
||||
|
||||
help_text = 'Browse and trigger keyboard shortcuts and actions'
|
||||
|
||||
Reference in New Issue
Block a user