notify_on_cmd_finish: Show the actual command that was finished

Fixes #7420
This commit is contained in:
Kovid Goyal
2024-05-09 09:49:26 +05:30
parent c50e38a080
commit 0d68a21be5
9 changed files with 123 additions and 56 deletions

View File

@@ -53,6 +53,10 @@ Detailed list of changes
0.35.0 [future]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :opt:`notify_on_cmd_finish`: Show the actual command that was finished (:iss:`7420`)
- Shell integration: Make the currently executing cmdline available as a window variable in kitty
- :opt:`paste_actions`: Fix ``replace-newline`` not working with ``confirm`` (:iss:`7374`)
- Graphics: Fix aspect ratio of images not being preserved when only a single

View File

@@ -147,7 +147,7 @@ functions for the events you are interested in, for example:
def on_cmd_startstop(boss: Boss, window: Window, data: Dict[str, Any]) -> None:
# called when the shell starts/stops executing a command. Here
# data will contain is_start and time.
# data will contain is_start, cmdline and time.
Every callback is passed a reference to the global ``Boss`` object as well as
the ``Window`` object the action is occurring on. The ``data`` object is a dict

View File

@@ -433,6 +433,10 @@ Just before running a command/program, send the escape code::
<OSC>133;C<ST>
Optionally, when a command is finished its "exit status" can be reported as::
<OSC>133;D;exit status as base 10 integer<ST>
Here ``<OSC>`` is the bytes ``0x1b 0x5d`` and ``<ST>`` is the bytes ``0x1b
0x5c``. This is exactly what is needed for shell integration in kitty. For the
full protocol, that also marks the command region, see `the iTerm2 docs
@@ -451,3 +455,13 @@ to control its behavior, separated by semi-colons. They are::
k=s - this tells kitty that the secondary (PS2) prompt is starting at the
current line.
kitty also optionally supports sending the cmdline going to be executed with ``<OSC>133;C`` as::
<OSC>133;C;cmdline=cmdline as space separated hex encoded text<ST>
or
<OSC>133;C;cmdline_url=cmdline as UTF-8 URL escaped text<ST>
Here, *space separated hex encoded text* means every unicode codepoint of the
command line is encoded as 2-8 hex digits separated by spaces.