close_tab keybind implemented. default set.

This commit is contained in:
Sabarigirish Manikandan
2024-12-28 21:56:58 +05:30
committed by Mitchell Hashimoto
parent 68a8c05f19
commit 1c8c82ee5a
2 changed files with 13 additions and 3 deletions

View File

@ -537,15 +537,15 @@ fn closeTab(_: *App, target: apprt.Target) !void {
switch (target) {
.app => {},
.surface => |v| {
const window = v.rt_surface.container.window() orelse {
const tab = v.rt_surface.container.tab() orelse {
log.info(
"close_tab invalid for container={s}",
.{@tagName(v.rt_surface.container)},
);
return;
};
// TODO: get tab from surface
try window.closeTab(v);
tab.window.closeTab(tab);
},
}
}

View File

@ -2373,6 +2373,11 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
.{ .key = .{ .translated = .t }, .mods = .{ .ctrl = true, .shift = true } },
.{ .new_tab = {} },
);
try result.keybind.set.put(
alloc,
.{ .key = .{ .translated = .x }, .mods = .{ .ctrl = true, .shift = true } },
.{ .close_tab = {} },
);
try result.keybind.set.put(
alloc,
.{ .key = .{ .translated = .left }, .mods = .{ .ctrl = true, .shift = true } },
@ -2653,6 +2658,11 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
.{ .key = .{ .translated = .t }, .mods = .{ .super = true } },
.{ .new_tab = {} },
);
try result.keybind.set.put(
alloc,
.{ .key = .{ .translated = .x }, .mods = .{ .super = true } },
.{ .close_tab = {} },
);
try result.keybind.set.put(
alloc,
.{ .key = .{ .translated = .left_bracket }, .mods = .{ .super = true, .shift = true } },