diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index 3d30d9ba5..46a982348 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -293,6 +293,7 @@ fn updateConfigErrors(self: *App) !void { 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("app.toggle_inspector", .{ .inspector = .toggle }); try self.syncActionAccelerator("win.close", .{ .close_surface = {} }); @@ -479,6 +480,17 @@ fn gtkActivate(app: *c.GtkApplication, ud: ?*anyopaque) callconv(.C) void { }, .{ .forever = {} }); } +fn gtkActionOpenConfig( + _: *c.GSimpleAction, + _: *c.GVariant, + ud: ?*anyopaque, +) callconv(.C) void { + const self: *App = @ptrCast(@alignCast(ud orelse return)); + _ = self.core_app.mailbox.push(.{ + .open_config = {}, + }, .{ .forever = {} }); +} + fn gtkActionReloadConfig( _: *c.GSimpleAction, _: *c.GVariant, @@ -507,6 +519,7 @@ fn gtkActionQuit( fn initActions(self: *App) void { const actions = .{ .{ "quit", >kActionQuit }, + .{ "open_config", >kActionOpenConfig }, .{ "reload_config", >kActionReloadConfig }, }; @@ -545,6 +558,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 Configuration", "app.open_config"); c.g_menu_append(section, "Reload Configuration", "app.reload_config"); c.g_menu_append(section, "About Ghostty", "win.about"); } diff --git a/src/config/Config.zig b/src/config/Config.zig index 5b816c676..025d09412 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -946,11 +946,18 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config { const alloc = result._arena.?.allocator(); // Add our default keybindings + + // keybinds for opening and reloading config try result.keybind.set.put( alloc, - .{ .key = .space, .mods = .{ .super = true, .alt = true, .ctrl = true } }, + .{ .key = .comma, .mods = inputpkg.ctrlOrSuper(.{ .shift = true }) }, .{ .reload_config = {} }, ); + try result.keybind.set.put( + alloc, + .{ .key = .comma, .mods = inputpkg.ctrlOrSuper(.{}) }, + .{ .open_config = {} }, + ); { // On macOS we default to super but Linux ctrl+shift since @@ -1210,16 +1217,6 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config { .{ .key = .q, .mods = .{ .super = true } }, .{ .quit = {} }, ); - try result.keybind.set.put( - alloc, - .{ .key = .comma, .mods = .{ .super = true, .shift = true } }, - .{ .reload_config = {} }, - ); - try result.keybind.set.put( - alloc, - .{ .key = .comma, .mods = .{ .super = true } }, - .{ .open_config = {} }, - ); try result.keybind.set.put( alloc, .{ .key = .k, .mods = .{ .super = true } },