mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
apprt/gtk: add menu button for opening scrollback file
This commit is contained in:

committed by
Mitchell Hashimoto

parent
6fde429728
commit
4e9639711c
@ -358,6 +358,7 @@ fn syncActionAccelerators(self: *App) !void {
|
||||
try self.syncActionAccelerator("app.quit", .{ .quit = {} });
|
||||
try self.syncActionAccelerator("app.open_config", .{ .open_config = {} });
|
||||
try self.syncActionAccelerator("app.reload_config", .{ .reload_config = {} });
|
||||
try self.syncActionAccelerator("win.open_scrollback", .{ .write_scrollback_file = .open });
|
||||
try self.syncActionAccelerator("win.toggle_inspector", .{ .inspector = .toggle });
|
||||
try self.syncActionAccelerator("win.close", .{ .close_surface = {} });
|
||||
try self.syncActionAccelerator("win.new_window", .{ .new_window = {} });
|
||||
@ -772,6 +773,7 @@ fn initMenu(self: *App) void {
|
||||
defer c.g_object_unref(section);
|
||||
c.g_menu_append_section(menu, null, @ptrCast(@alignCast(section)));
|
||||
c.g_menu_append(section, "Terminal Inspector", "win.toggle_inspector");
|
||||
c.g_menu_append(section, "Open Scrollback", "win.open_scrollback");
|
||||
c.g_menu_append(section, "Open Configuration", "app.open_config");
|
||||
c.g_menu_append(section, "Reload Configuration", "app.reload_config");
|
||||
c.g_menu_append(section, "About Ghostty", "win.about");
|
||||
|
@ -173,6 +173,7 @@ fn initActions(self: *Window) void {
|
||||
.{ "split_right", >kActionSplitRight },
|
||||
.{ "split_down", >kActionSplitDown },
|
||||
.{ "toggle_inspector", >kActionToggleInspector },
|
||||
.{ "open_scrollback", >kActionOpenScrollback },
|
||||
};
|
||||
|
||||
inline for (actions) |entry| {
|
||||
@ -580,6 +581,19 @@ fn gtkActionToggleInspector(
|
||||
};
|
||||
}
|
||||
|
||||
fn gtkActionOpenScrollback(
|
||||
_: *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(.{ .write_scrollback_file = .open }) 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);
|
||||
|
Reference in New Issue
Block a user