mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-19 19:41:27 +00:00
Add settings shortcut on MacOS
- Settings shortcut opens the config file in the default editor. Signed-off-by: Borja Clemente <borja.clemente@gmail.com>
This commit is contained in:
@@ -47,6 +47,9 @@ pub const App = struct {
|
||||
/// called.
|
||||
reload_config: *const fn (AppUD) callconv(.C) ?*const Config,
|
||||
|
||||
/// Open the configuration file.
|
||||
open_config: *const fn (AppUD) callconv(.C) void,
|
||||
|
||||
/// Called to set the title of the window.
|
||||
set_title: *const fn (SurfaceUD, [*]const u8) callconv(.C) void,
|
||||
|
||||
@@ -160,6 +163,10 @@ pub const App = struct {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn openConfig(self: *App) !void {
|
||||
try Config.edit(self.core_app.alloc);
|
||||
}
|
||||
|
||||
pub fn reloadConfig(self: *App) !?*const Config {
|
||||
// Reload
|
||||
if (self.opts.reload_config(self.opts.userdata)) |new| {
|
||||
@@ -1285,6 +1292,14 @@ pub const CAPI = struct {
|
||||
};
|
||||
}
|
||||
|
||||
/// Open the configuration.
|
||||
export fn ghostty_app_open_config(v: *App) void {
|
||||
_ = v.core_app.openConfig(v) catch |err| {
|
||||
log.err("error reloading config err={}", .{err});
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
/// Reload the configuration.
|
||||
export fn ghostty_app_reload_config(v: *App) void {
|
||||
_ = v.core_app.reloadConfig(v) catch |err| {
|
||||
|
||||
Reference in New Issue
Block a user