From 5c343c918d1a94c9da321b0021d7e6ec4c624088 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Jan 2022 13:32:25 +0530 Subject: [PATCH] Add a --hold option for the launch command --- kitty/launch.py | 9 +++++++++ kitty/rc/launch.py | 1 + 2 files changed, 10 insertions(+) diff --git a/kitty/launch.py b/kitty/launch.py index ec8eed5e0..b9d0aa33b 100644 --- a/kitty/launch.py +++ b/kitty/launch.py @@ -8,6 +8,7 @@ from .boss import Boss from .child import Child from .cli import parse_args from .cli_stub import LaunchCLIOptions +from .constants import kitty_exe, shell_path from .fast_data_types import patch_color_profiles, set_clipboard_string from .options.utils import env as parse_env from .tabs import Tab @@ -71,6 +72,11 @@ Using :code:`name=` will set to empty string and just :code:`name` will remove the environment variable. +--hold +type=bool-set +Keep the window open even after the command being executed exits. + + --copy-colors type=bool-set Set the colors of the newly created window to be the same as the colors in the @@ -398,6 +404,9 @@ def launch( else: set_primary_selection(stdin) else: + if opts.hold: + cmd = kw['cmd'] or [shell_path] + kw['cmd'] = [kitty_exe(), '+hold'] + cmd if force_target_tab: tab = target_tab else: diff --git a/kitty/rc/launch.py b/kitty/rc/launch.py index 890a76e63..ddda00bd7 100644 --- a/kitty/rc/launch.py +++ b/kitty/rc/launch.py @@ -33,6 +33,7 @@ class Launch(RemoteCommand): copy_colors: Boolean indicating whether to copy the colors from the current window copy_cmdline: Boolean indicating whether to copy the cmdline from the current window copy_env: Boolean indicating whether to copy the environ from the current window + hold: Boolean indicating whether to keep window open after cmd exits location: Where in the tab to open the new window allow_remote_control: Boolean indicating whether to allow remote control from the new window stdin_source: Where to get stdin for thew process from