diff --git a/kitty/cmds.py b/kitty/cmds.py index f934aef60..9f3adbeb4 100644 --- a/kitty/cmds.py +++ b/kitty/cmds.py @@ -890,6 +890,7 @@ def cmd_launch(global_opts, opts, args): stdin_add_formatting: Boolean indicating whether to add formatting codes to stdin stdin_add_line_wrap_markers: Boolean indicating whether to add line wrap markers to stdin no_response: Boolean indicating whether to send back the window id + marker: Specification for marker for new window, for example: "text 1 ERROR" ''' if opts.no_response: global_opts.no_command_response = True diff --git a/kitty/launch.py b/kitty/launch.py index 1bd97864f..6e98ff696 100644 --- a/kitty/launch.py +++ b/kitty/launch.py @@ -116,6 +116,9 @@ want to pipe to program that wants to duplicate the screen layout of the screen. +--marker +Create a marker that highlights text in the newly created window. The syntax is +the same as for the :opt:`toggle_marker` map action. ''' options_spec.ans = OPTIONS return options_spec.ans @@ -178,6 +181,8 @@ def launch(boss, opts, args, target_tab=None): kw['override_title'] = opts.window_title if opts.copy_colors and active: kw['copy_colors_from'] = active + if opts.marker: + kw['marker'] = opts.marker cmd = args or None if opts.copy_cmdline and active_child: cmd = active_child.foreground_cmdline diff --git a/kitty/tabs.py b/kitty/tabs.py index b804ac374..2b54e57b2 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -263,7 +263,7 @@ class Tab: # {{{ def new_window( self, use_shell=True, cmd=None, stdin=None, override_title=None, cwd_from=None, cwd=None, overlay_for=None, env=None, location=None, - copy_colors_from=None, allow_remote_control=False + copy_colors_from=None, allow_remote_control=False, marker=None ): child = self.launch_child( use_shell=use_shell, cmd=cmd, stdin=stdin, cwd_from=cwd_from, cwd=cwd, env=env, allow_remote_control=allow_remote_control) @@ -275,6 +275,12 @@ class Tab: # {{{ # Must add child before laying out so that resize_pty succeeds get_boss().add_child(window) self._add_window(window, location=location) + if marker: + try: + window.set_marker(marker) + except Exception: + import traceback + traceback.print_exc() return window def new_special_window(self, special_window, location=None, copy_colors_from=None, allow_remote_control=False):