remote_control_script: resolve relative paths with respect to kitty config directory

Fixes #9625
This commit is contained in:
Kovid Goyal
2026-03-09 08:35:28 +05:30
parent db5453c291
commit 5722acad4f
3 changed files with 9 additions and 2 deletions

View File

@@ -269,6 +269,9 @@ Detailed list of changes
- Allow double clicking on a tab to rename it (:pull:`9609`) - Allow double clicking on a tab to rename it (:pull:`9609`)
- :ac:`remote_control_script` resolve relative paths with respect to kitty
config directory (:iss:`9625`)
0.45.0 [2025-12-24] 0.45.0 [2025-12-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -298,7 +298,8 @@ control commands as you like and process their output.
:ac:`launch` command with ``--type=background --allow-remote-control``. :ac:`launch` command with ``--type=background --allow-remote-control``.
For more advanced usage, including fine grained permissions, setting For more advanced usage, including fine grained permissions, setting
env vars, command line interpolation, passing data to STDIN, etc. env vars, command line interpolation, passing data to STDIN, etc.
the :doc:`launch <launch>` command should be used. the :doc:`launch <launch>` command should be used. Relative paths to scripts
are interpreted with respect to the kitty config directory.
.. note:: You do not need :opt:`allow_remote_control` to use these mappings, .. note:: You do not need :opt:`allow_remote_control` to use these mappings,
as they are not actual remote programs, but are simply a way to reuse the as they are not actual remote programs, but are simply a way to reuse the

View File

@@ -165,6 +165,7 @@ from .utils import (
parse_address_spec, parse_address_spec,
parse_os_window_state, parse_os_window_state,
platform_window_id, platform_window_id,
resolve_custom_file,
safe_print, safe_print,
sanitize_url_for_display_to_user, sanitize_url_for_display_to_user,
shlex_split, shlex_split,
@@ -855,9 +856,11 @@ class Boss:
map f1 remote_control_script /path/to/script arg1 arg2 ... map f1 remote_control_script /path/to/script arg1 arg2 ...
See :ref:`rc_mapping` for details. See :ref:`rc_mapping` for details. Relative paths are resolved with respect
to the kitty config directory.
''') ''')
def remote_control_script(self, path: str, *args: str) -> None: def remote_control_script(self, path: str, *args: str) -> None:
path = resolve_custom_file(path)
path = which(path) or path path = which(path) or path
if not os.access(path, os.X_OK): if not os.access(path, os.X_OK):
self.show_error('Remote control script not executable', f'The script {path} is not executable check its permissions') self.show_error('Remote control script not executable', f'The script {path} is not executable check its permissions')