From 352f940010687ffd6191ced5eaf4abb340e78ce1 Mon Sep 17 00:00:00 2001 From: pagedown Date: Mon, 23 Jan 2023 14:15:27 +0800 Subject: [PATCH] Fix SHELL env var in open-actions.conf and launch-actions.conf Only the executable path is used when expanding `$SHELL`. Also fix the non-working example `{SHELL}` in the documentation. --- docs/open_actions.rst | 7 +++++++ kitty/open_actions.py | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/open_actions.rst b/docs/open_actions.rst index 0dc659941..9891a64e2 100644 --- a/docs/open_actions.rst +++ b/docs/open_actions.rst @@ -68,6 +68,13 @@ some special variables, documented below: The path, query and fragment portions of the URL, without any unquoting. +``EDITOR`` + The terminal based text editor. The configured :opt:`editor` in + :file:`kitty.conf` is preferred. + +``SHELL`` + The path to the shell. The configured :opt:`shell` in :file:`kitty.conf` is + preferred, without arguments. .. note:: You can use the :opt:`action_alias` option just as in :file:`kitty.conf` to diff --git a/kitty/open_actions.py b/kitty/open_actions.py index 2b09ee04f..d573fdbef 100644 --- a/kitty/open_actions.py +++ b/kitty/open_actions.py @@ -74,7 +74,7 @@ def parse(lines: Iterable[str]) -> Iterator[OpenAction]: with to_cmdline_implementation.filter_env_vars( 'URL', 'FILE_PATH', 'FILE', 'FRAGMENT', 'URL_PATH', EDITOR=shlex.join(get_editor()), - SHELL=shlex.join(resolved_shell(get_options())) + SHELL=resolved_shell(get_options())[0] ): for (mc, action_defns) in entries: actions: List[KeyAction] = [] @@ -234,12 +234,11 @@ action show_kitty_doc $URL_PATH @run_once def default_launch_actions() -> Tuple[OpenAction, ...]: - SHELL = resolved_shell(get_options()) - return tuple(parse(f'''\ + return tuple(parse('''\ # Open script files protocol file ext sh,command,tool -action launch --hold --type=os-window kitty +shebang $FILE_PATH {SHELL} +action launch --hold --type=os-window kitty +shebang $FILE_PATH $SHELL # Open shell specific script files protocol file