mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-29 11:57:57 +00:00
Add close tabs on the right action
This commit is contained in:
committed by
Mitchell Hashimoto
parent
894e8d91ba
commit
625d7274bf
@@ -5299,6 +5299,7 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
||||
switch (v) {
|
||||
.this => .this,
|
||||
.other => .other,
|
||||
.right => .right,
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
@@ -767,6 +767,8 @@ pub const CloseTabMode = enum(c_int) {
|
||||
this,
|
||||
/// Close all other tabs.
|
||||
other,
|
||||
/// Close all tabs to the right of the current tab.
|
||||
right,
|
||||
};
|
||||
|
||||
pub const CommandFinished = struct {
|
||||
|
||||
@@ -347,6 +347,7 @@ pub const Tab = extern struct {
|
||||
switch (mode) {
|
||||
.this => tab_view.closePage(page),
|
||||
.other => tab_view.closeOtherPages(page),
|
||||
.right => tab_view.closePagesAfter(page),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ template $GhosttyWindow: Adw.ApplicationWindow {
|
||||
page-attached => $page_attached();
|
||||
page-detached => $page_detached();
|
||||
create-window => $tab_create_window();
|
||||
menu-model: tab_context_menu;
|
||||
shortcuts: none;
|
||||
}
|
||||
}
|
||||
@@ -192,6 +193,35 @@ menu split_menu {
|
||||
}
|
||||
}
|
||||
|
||||
menu tab_context_menu {
|
||||
section {
|
||||
item {
|
||||
label: _("New Tab");
|
||||
action: "win.new-tab";
|
||||
}
|
||||
}
|
||||
|
||||
section {
|
||||
item {
|
||||
label: _("Close Tab");
|
||||
action: "tab.close";
|
||||
target: "this";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("Close Other Tabs");
|
||||
action: "tab.close";
|
||||
target: "other";
|
||||
}
|
||||
|
||||
item {
|
||||
label: _("Close Tabs on the Right");
|
||||
action: "tab.close";
|
||||
target: "right";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
menu main_menu {
|
||||
section {
|
||||
item {
|
||||
|
||||
@@ -600,9 +600,8 @@ pub const Action = union(enum) {
|
||||
/// of the `confirm-close-surface` configuration setting.
|
||||
close_surface,
|
||||
|
||||
/// Close the current tab and all splits therein _or_ close all tabs and
|
||||
/// splits thein of tabs _other_ than the current tab, depending on the
|
||||
/// mode.
|
||||
/// Close the current tab and all splits therein, close all other tabs, or
|
||||
/// close every tab to the right of the current one depending on the mode.
|
||||
///
|
||||
/// If the mode is not specified, defaults to closing the current tab.
|
||||
///
|
||||
@@ -1005,6 +1004,7 @@ pub const Action = union(enum) {
|
||||
pub const CloseTabMode = enum {
|
||||
this,
|
||||
other,
|
||||
right,
|
||||
|
||||
pub const default: CloseTabMode = .this;
|
||||
};
|
||||
|
||||
@@ -538,6 +538,11 @@ fn actionCommands(action: Action.Key) []const Command {
|
||||
.title = "Close Other Tabs",
|
||||
.description = "Close all tabs in this window except the current one.",
|
||||
},
|
||||
.{
|
||||
.action = .{ .close_tab = .right },
|
||||
.title = "Close Tabs on the Right",
|
||||
.description = "Close every tab to the right of the current one.",
|
||||
},
|
||||
},
|
||||
|
||||
.close_window => comptime &.{.{
|
||||
|
||||
Reference in New Issue
Block a user