diff --git a/include/ghostty.h b/include/ghostty.h
index 357d40de5..8c19150b1 100644
--- a/include/ghostty.h
+++ b/include/ghostty.h
@@ -353,6 +353,7 @@ typedef struct {
} ghostty_surface_config_s;
typedef void (*ghostty_runtime_wakeup_cb)(void *);
+typedef void (*ghostty_runtime_open_config_cb)(void *);
typedef const ghostty_config_t (*ghostty_runtime_reload_config_cb)(void *);
typedef void (*ghostty_runtime_set_title_cb)(void *, const char *);
typedef void (*ghostty_runtime_set_mouse_shape_cb)(void *, ghostty_mouse_shape_e);
@@ -380,6 +381,7 @@ typedef struct {
void *userdata;
bool supports_selection_clipboard;
ghostty_runtime_wakeup_cb wakeup_cb;
+ ghostty_runtime_open_config_cb open_config_cb;
ghostty_runtime_reload_config_cb reload_config_cb;
ghostty_runtime_set_title_cb set_title_cb;
ghostty_runtime_set_mouse_shape_cb set_mouse_shape_cb;
@@ -422,12 +424,14 @@ bool ghostty_config_get(ghostty_config_t, void *, const char *, uintptr_t);
ghostty_input_trigger_s ghostty_config_trigger(ghostty_config_t, const char *, uintptr_t);
uint32_t ghostty_config_errors_count(ghostty_config_t);
ghostty_error_s ghostty_config_get_error(ghostty_config_t, uint32_t);
+void ghostty_config_open();
ghostty_app_t ghostty_app_new(const ghostty_runtime_config_s *, ghostty_config_t);
void ghostty_app_free(ghostty_app_t);
bool ghostty_app_tick(ghostty_app_t);
void *ghostty_app_userdata(ghostty_app_t);
void ghostty_app_keyboard_changed(ghostty_app_t);
+void ghostty_app_open_config(ghostty_app_t);
void ghostty_app_reload_config(ghostty_app_t);
bool ghostty_app_needs_confirm_quit(ghostty_app_t);
diff --git a/macos/Sources/AppDelegate.swift b/macos/Sources/AppDelegate.swift
index b99d45ba8..8dc07095d 100644
--- a/macos/Sources/AppDelegate.swift
+++ b/macos/Sources/AppDelegate.swift
@@ -12,6 +12,7 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, UNUserNoti
)
/// Various menu items so that we can programmatically sync the keyboard shortcut with the Ghostty config.
+ @IBOutlet private var menuOpenConfig: NSMenuItem?
@IBOutlet private var menuReloadConfig: NSMenuItem?
@IBOutlet private var menuQuit: NSMenuItem?
@@ -211,6 +212,7 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, UNUserNoti
private func syncMenuShortcuts() {
guard ghostty.config != nil else { return }
+ syncMenuShortcut(action: "open_config", menuItem: self.menuOpenConfig)
syncMenuShortcut(action: "reload_config", menuItem: self.menuReloadConfig)
syncMenuShortcut(action: "quit", menuItem: self.menuQuit)
@@ -340,6 +342,10 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, UNUserNoti
//MARK: - IB Actions
+ @IBAction func openConfig(_ sender: Any?) {
+ ghostty.openConfig()
+ }
+
@IBAction func reloadConfig(_ sender: Any?) {
ghostty.reloadConfig()
}
diff --git a/macos/Sources/Ghostty/AppState.swift b/macos/Sources/Ghostty/AppState.swift
index f9f4da8b8..df1bc56bd 100644
--- a/macos/Sources/Ghostty/AppState.swift
+++ b/macos/Sources/Ghostty/AppState.swift
@@ -146,6 +146,7 @@ extension Ghostty {
userdata: Unmanaged.passUnretained(self).toOpaque(),
supports_selection_clipboard: false,
wakeup_cb: { userdata in AppState.wakeup(userdata) },
+ open_config_cb: { userdata in AppState.openConfig(userdata) },
reload_config_cb: { userdata in AppState.reloadConfig(userdata) },
set_title_cb: { userdata, title in AppState.setTitle(userdata, title: title) },
set_mouse_shape_cb: { userdata, shape in AppState.setMouseShape(userdata, shape: shape) },
@@ -267,6 +268,11 @@ extension Ghostty {
NSApplication.shared.terminate(nil)
}
+ func openConfig() {
+ guard let app = self.app else { return }
+ ghostty_app_open_config(app)
+ }
+
func reloadConfig() {
guard let app = self.app else { return }
ghostty_app_reload_config(app)
@@ -489,6 +495,10 @@ extension Ghostty {
)
}
+ static func openConfig(_ userdata: UnsafeMutableRawPointer?) {
+ ghostty_config_open();
+ }
+
static func reloadConfig(_ userdata: UnsafeMutableRawPointer?) -> ghostty_config_t? {
guard let newConfig = Self.loadConfig() else {
AppDelegate.logger.warning("failed to reload configuration")
diff --git a/macos/Sources/MainMenu.xib b/macos/Sources/MainMenu.xib
index c9317efbb..e1d54bc59 100644
--- a/macos/Sources/MainMenu.xib
+++ b/macos/Sources/MainMenu.xib
@@ -27,6 +27,7 @@
+
@@ -57,7 +58,11 @@
-
+