diff --git a/include/ghostty.h b/include/ghostty.h index e5afb6d1e..9e01c9253 100644 --- a/include/ghostty.h +++ b/include/ghostty.h @@ -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 { diff --git a/src/Surface.zig b/src/Surface.zig index a28b5ec2d..443f9daf4 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -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, diff --git a/src/apprt/action.zig b/src/apprt/action.zig index 6db465277..fcf43ca07 100644 --- a/src/apprt/action.zig +++ b/src/apprt/action.zig @@ -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_"); diff --git a/src/apprt/gtk/class/application.zig b/src/apprt/gtk/class/application.zig index 1241c7340..6d50c3b72 100644 --- a/src/apprt/gtk/class/application.zig +++ b/src/apprt/gtk/class/application.zig @@ -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; diff --git a/src/input/Binding.zig b/src/input/Binding.zig index 5b14067db..a2bae642a 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -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, diff --git a/src/input/command.zig b/src/input/command.zig index 040944164..6560148bc 100644 --- a/src/input/command.zig +++ b/src/input/command.zig @@ -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"),