core: add 'command finished' notifications

Fixes #8991

Uses OSC 133 esc sequences to keep track of how long commands take to
execute. If the user chooses, commands that take longer than a user
specified limit will trigger a notification. The user can choose between
a bell notification or a desktop notification.
This commit is contained in:
Jeffrey C. Ollie
2025-10-01 23:48:08 -05:00
parent 9c8d2e577e
commit 07124dba64
12 changed files with 366 additions and 25 deletions

View File

@@ -733,6 +733,14 @@ typedef struct {
int8_t progress;
} ghostty_action_progress_report_s;
// apprt.action.CommandFinished.C
typedef struct {
// -1 if no exit code was reported, otherwise 0-255
int16_t exit_code;
// number of nanoseconds that command was running for
uint64_t duration;
} ghostty_action_command_finished_s;
// apprt.Action.Key
typedef enum {
GHOSTTY_ACTION_QUIT,
@@ -788,6 +796,7 @@ typedef enum {
GHOSTTY_ACTION_SHOW_CHILD_EXITED,
GHOSTTY_ACTION_PROGRESS_REPORT,
GHOSTTY_ACTION_SHOW_ON_SCREEN_KEYBOARD,
GHOSTTY_ACTION_COMMAND_FINISHED,
} ghostty_action_tag_e;
typedef union {
@@ -819,6 +828,7 @@ typedef union {
ghostty_action_close_tab_mode_e close_tab_mode;
ghostty_surface_message_childexited_s child_exited;
ghostty_action_progress_report_s progress_report;
ghostty_action_command_finished_s command_finished;
} ghostty_action_u;
typedef struct {