core: prompt_tab_title binding and apprt action

pull/9879/head
Mitchell Hashimoto 2025-12-11 16:00:13 -08:00
parent 4d757f0f28
commit 32033c9e1a
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
5 changed files with 26 additions and 1 deletions

View File

@ -804,6 +804,7 @@ typedef enum {
GHOSTTY_ACTION_DESKTOP_NOTIFICATION,
GHOSTTY_ACTION_SET_TITLE,
GHOSTTY_ACTION_PROMPT_TITLE,
GHOSTTY_ACTION_PROMPT_TAB_TITLE,
GHOSTTY_ACTION_PWD,
GHOSTTY_ACTION_MOUSE_SHAPE,
GHOSTTY_ACTION_MOUSE_VISIBILITY,
@ -831,7 +832,7 @@ typedef enum {
GHOSTTY_ACTION_END_SEARCH,
GHOSTTY_ACTION_SEARCH_TOTAL,
GHOSTTY_ACTION_SEARCH_SELECTED,
} ghostty_action_tag_e;
} ghostty_action_tag_e;
typedef union {
ghostty_action_split_direction_e new_split;

View File

@ -5186,6 +5186,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
{},
),
.prompt_tab_title => return try self.rt_app.performAction(
.{ .surface = self },
.prompt_tab_title,
{},
),
.clear_screen => {
// This is a duplicate of some of the logic in termio.clearScreen
// but we need to do this here so we can know the answer before

View File

@ -192,6 +192,11 @@ pub const Action = union(Key) {
/// the apprt to prompt.
prompt_title,
/// Set the title of the current tab/window to a prompted value. The title
/// set via this prompt overrides any title set by the terminal and persists
/// across focus changes within the tab. It is up to the apprt to prompt.
prompt_tab_title,
/// The current working directory has changed for the target terminal.
pwd: Pwd,
@ -347,6 +352,7 @@ pub const Action = union(Key) {
desktop_notification,
set_title,
prompt_title,
prompt_tab_title,
pwd,
mouse_shape,
mouse_visibility,

View File

@ -519,6 +519,11 @@ pub const Action = union(enum) {
/// version can be found by running `ghostty +version`.
prompt_surface_title,
/// Change the title of the current tab/window via a pop-up prompt. The
/// title set via this prompt overrides any title set by the terminal
/// and persists across focus changes within the tab.
prompt_tab_title,
/// Create a new split in the specified direction.
///
/// Valid arguments:
@ -1191,6 +1196,7 @@ pub const Action = union(enum) {
.reset_font_size,
.set_font_size,
.prompt_surface_title,
.prompt_tab_title,
.clear_screen,
.select_all,
.scroll_to_top,

View File

@ -417,6 +417,12 @@ fn actionCommands(action: Action.Key) []const Command {
.description = "Prompt for a new title for the current terminal.",
}},
.prompt_tab_title => comptime &.{.{
.action = .prompt_tab_title,
.title = "Change Tab Title...",
.description = "Prompt for a new title for the current tab.",
}},
.new_split => comptime &.{
.{
.action = .{ .new_split = .left },