mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-28 03:26:28 +00:00
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:
@@ -295,6 +295,9 @@ pub const Action = union(Key) {
|
||||
/// Show the on-screen keyboard.
|
||||
show_on_screen_keyboard,
|
||||
|
||||
/// A command has finished,
|
||||
command_finished: CommandFinished,
|
||||
|
||||
/// Sync with: ghostty_action_tag_e
|
||||
pub const Key = enum(c_int) {
|
||||
quit,
|
||||
@@ -350,6 +353,7 @@ pub const Action = union(Key) {
|
||||
show_child_exited,
|
||||
progress_report,
|
||||
show_on_screen_keyboard,
|
||||
command_finished,
|
||||
};
|
||||
|
||||
/// Sync with: ghostty_action_u
|
||||
@@ -741,3 +745,21 @@ pub const CloseTabMode = enum(c_int) {
|
||||
/// Close all other tabs.
|
||||
other,
|
||||
};
|
||||
|
||||
pub const CommandFinished = struct {
|
||||
exit_code: ?u8,
|
||||
duration: configpkg.Config.Duration,
|
||||
|
||||
/// sync with ghostty_action_command_finished_s in ghostty.h
|
||||
pub const C = extern struct {
|
||||
exit_code: i16,
|
||||
duration: u64,
|
||||
};
|
||||
|
||||
pub fn cval(self: CommandFinished) C {
|
||||
return .{
|
||||
.exit_code = self.exit_code orelse -1,
|
||||
.duration = self.duration.duration,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user