diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 60fefc6de..462c46067 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -370,6 +370,7 @@ fn syncActionAccelerators(self: *App) !void { try self.syncActionAccelerator("win.split_down", .{ .new_split = .down }); try self.syncActionAccelerator("win.copy", .{ .copy_to_clipboard = {} }); try self.syncActionAccelerator("win.paste", .{ .paste_from_clipboard = {} }); + try self.syncActionAccelerator("win.reset", .{ .reset = {} }); } fn syncActionAccelerator( @@ -811,6 +812,7 @@ fn initContextMenu(self: *App) void { const section = c.g_menu_new(); defer c.g_object_unref(section); c.g_menu_append_section(menu, null, @ptrCast(@alignCast(section))); + c.g_menu_append(section, "Reset", "win.reset"); c.g_menu_append(section, "Terminal Inspector", "win.toggle_inspector"); } diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index 384145332..c388e0092 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -184,6 +184,7 @@ fn initActions(self: *Window) void { .{ "toggle_inspector", >kActionToggleInspector }, .{ "copy", >kActionCopy }, .{ "paste", >kActionPaste }, + .{ "reset", >kActionReset }, }; inline for (actions) |entry| { @@ -629,6 +630,19 @@ fn gtkActionPaste( }; } +fn gtkActionReset( + _: *c.GSimpleAction, + _: *c.GVariant, + ud: ?*anyopaque, +) callconv(.C) void { + const self: *Window = @ptrCast(@alignCast(ud orelse return)); + const surface = self.actionSurface() orelse return; + _ = surface.performBindingAction(.{ .reset = {} }) catch |err| { + log.warn("error performing binding action error={}", .{err}); + return; + }; +} + /// Returns the surface to use for an action. fn actionSurface(self: *Window) ?*CoreSurface { const page_idx = c.gtk_notebook_get_current_page(self.notebook);