gtk-ng: implement close_tab:other keybind (#8403)

This commit is contained in:
Mitchell Hashimoto
2025-08-26 10:48:55 -07:00
committed by GitHub
3 changed files with 12 additions and 23 deletions

View File

@@ -353,7 +353,7 @@ pub const Tab = extern struct {
// a close-page signal that the parent can intercept.
switch (mode) {
.this => tab_view.closePage(page),
.other => log.warn("close-tab:other is not implemented", .{}),
.other => tab_view.closeOtherPages(page),
}
}

View File

@@ -558,8 +558,6 @@ pub const Action = union(enum) {
///
/// If the mode is not specified, defaults to closing the current tab.
///
/// close-tab:other is only available on macOS.
///
/// This might trigger a close confirmation popup, depending on the value
/// of the `confirm-close-surface` configuration setting.
close_tab: CloseTabMode,

View File

@@ -393,27 +393,18 @@ fn actionCommands(action: Action.Key) []const Command {
.description = "Close the current terminal.",
}},
.close_tab => comptime if (builtin.target.os.tag.isDarwin())
&.{
.{
.action = .{ .close_tab = .this },
.title = "Close Tab",
.description = "Close the current tab.",
},
.{
.action = .{ .close_tab = .other },
.title = "Close Other Tabs",
.description = "Close all tabs in this window except the current one.",
},
}
else
&.{
.{
.action = .{ .close_tab = .this },
.title = "Close Tab",
.description = "Close the current tab.",
},
.close_tab => comptime &.{
.{
.action = .{ .close_tab = .this },
.title = "Close Tab",
.description = "Close the current tab.",
},
.{
.action = .{ .close_tab = .other },
.title = "Close Other Tabs",
.description = "Close all tabs in this window except the current one.",
},
},
.close_window => comptime &.{.{
.action = .close_window,