input,apprt: add new_tab_to_new_window action

This commit is contained in:
Leah Amelia Chen
2026-08-05 17:10:21 +08:00
parent 9e30f70f23
commit 25b2d8a385
6 changed files with 25 additions and 0 deletions

View File

@@ -956,6 +956,7 @@ typedef enum {
GHOSTTY_ACTION_SEARCH_SELECTED,
GHOSTTY_ACTION_READONLY,
GHOSTTY_ACTION_COPY_TITLE_TO_CLIPBOARD,
GHOSTTY_ACTION_MOVE_TAB_TO_NEW_WINDOW,
} ghostty_action_tag_e;
typedef union {

View File

@@ -5334,6 +5334,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
.{ .amount = position },
),
.move_tab_to_new_window => return try self.rt_app.performAction(
.{ .surface = self },
.move_tab_to_new_window,
{},
),
.new_split => |direction| return try self.rt_app.performAction(
.{ .surface = self },
.new_split,

View File

@@ -351,6 +351,9 @@ pub const Action = union(Key) {
/// otherwise the terminal-set title.
copy_title_to_clipboard,
/// Move a tab to a new window.
move_tab_to_new_window,
/// Sync with: ghostty_action_tag_e
pub const Key = enum(c_int) {
quit,
@@ -420,6 +423,7 @@ pub const Action = union(Key) {
search_selected,
readonly,
copy_title_to_clipboard,
move_tab_to_new_window,
test "ghostty.h Action.Key" {
try lib.checkGhosttyHEnum(Key, "GHOSTTY_ACTION_");

View File

@@ -799,6 +799,7 @@ pub const Application = extern struct {
.check_for_updates,
.undo,
.redo,
.move_tab_to_new_window,
=> {
log.warn("unimplemented action={}", .{action});
return false;

View File

@@ -587,6 +587,12 @@ pub const Action = union(enum) {
/// the last tab.
move_tab: isize,
/// Move a tab to a new window.
///
/// Only implemented on Linux, but there's a native tab menu provided by
/// macOS.
move_tab_to_new_window,
/// Toggle the tab overview.
///
/// This is only supported on Linux and when the system's libadwaita
@@ -1418,6 +1424,7 @@ pub const Action = union(enum) {
.last_tab,
.goto_tab,
.move_tab,
.move_tab_to_new_window,
.toggle_tab_overview,
.new_split,
.goto_split,

View File

@@ -441,6 +441,12 @@ fn actionCommands(action: Action.Key) []const Command {
},
},
.move_tab_to_new_window => comptime &.{.{
.action = .move_tab_to_new_window,
.title = i18n.N_("Move Tab to New Window"),
.description = i18n.N_("Move the current tab to a new window."),
}},
.toggle_tab_overview => comptime &.{.{
.action = .toggle_tab_overview,
.title = i18n.N_("Toggle Tab Overview"),