Fix ls --self and --output-format being ignored in remote_control mappings

The Python implementation of message_to_kitty did not forward these
options in the payload, so they only worked via kitten @.
This commit is contained in:
Kovid Goyal 2026-10-17 10:15:49 +05:30
parent 488b1415a6
commit b7a657de10
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 24 additions and 1 deletions

View file

@ -500,6 +500,9 @@ Detailed list of changes
- Remote control: Fix ``set-enabled-layouts --configured`` not updating the
default layouts for new tabs when used in a :ac:`remote_control` mapping.
- Remote control: Fix ``ls --self`` and ``ls --output-format`` being ignored
when used in a :ac:`remote_control` mapping.
0.49.2 [2026-10-01]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -58,7 +58,13 @@ Output in JSON or kitty session format
)
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
return {'all_env_vars': opts.all_env_vars, 'match': opts.match, 'match_tab': opts.match_tab}
return {
'all_env_vars': opts.all_env_vars,
'match': opts.match,
'match_tab': opts.match_tab,
'self': opts.self,
'output_format': opts.output_format,
}
def response_from_kitty(self, boss: Boss, window: Window | None, payload_get: PayloadGetType) -> ResponseType:
tab_filter: Callable[[Tab], bool] | None = None

View file

@ -51,6 +51,20 @@ class TestRemoteControl(BaseTest):
boss.active_tab.set_enabled_layouts.assert_called_once_with(['stack'])
self.ae(options.enabled_layouts, ['stack'] if configured else ['tall'])
def test_ls_self_and_output_format(self):
from kitty.boss import Boss as KittyBoss
self_window = Mock()
boss = Mock(list_os_windows=Mock(return_value=[]), serialize_state_as_session=Mock(return_value=['a', 'b']))
self.ae(KittyBoss.call_remote_control(boss, None, ('ls', '--output-format', 'session')), 'a\nb')
boss.list_os_windows.assert_not_called()
KittyBoss.call_remote_control(boss, self_window, ('ls', '--self'))
window_filter = boss.list_os_windows.call_args.args[2]
self.assertIsNotNone(window_filter)
self.assertTrue(window_filter(self_window))
self.assertFalse(window_filter(Mock()))
def test_set_os_window_title_command_is_registered(self):
self.assertIn('set_os_window_title', all_command_names())
self.ae(command_for_name('set-os-window-title').name, 'set-os-window-title')