gtk: add "Close Split" to right-click context menu

Add a "Close Split" option to the split submenu in the right-click
context menu, allowing users to close the focused split pane directly
from the context menu.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Caleb
2026-03-04 16:27:46 -08:00
parent 46522a8779
commit 7777dedd5f
2 changed files with 15 additions and 0 deletions

View File

@@ -186,6 +186,7 @@ pub const SplitTree = extern struct {
.init("new-split", actionNewSplit, s_variant_type),
.init("equalize", actionEqualize, null),
.init("zoom", actionZoom, null),
.init("close-pane", actionClosePane, null),
};
_ = ext.actions.addAsGroup(Self, self, "split-tree", &actions);
@@ -663,6 +664,15 @@ pub const SplitTree = extern struct {
self.as(gobject.Object).notifyByPspec(properties.tree.impl.param_spec);
}
pub fn actionClosePane(
_: *gio.SimpleAction,
_: ?*glib.Variant,
self: *Self,
) callconv(.c) void {
const surface = self.getActiveSurface() orelse return;
surface.close();
}
fn surfaceCloseRequest(
surface: *Surface,
self: *Self,

View File

@@ -316,6 +316,11 @@ menu context_menu_model {
action: "split-tree.new-split";
target: "right";
}
item {
label: _("Close Split");
action: "split-tree.close-pane";
}
}
submenu {