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:
Borja Clemente
2023-12-17 14:22:38 +01:00
parent 5eea79ad0d
commit 646e3c365c
10 changed files with 104 additions and 2 deletions

View File

@@ -186,6 +186,7 @@ fn drainMailbox(self: *App, rt_app: *apprt.App) !void {
log.debug("mailbox message={s}", .{@tagName(message)});
switch (message) {
.reload_config => try self.reloadConfig(rt_app),
.open_config => try self.openConfig(rt_app),
.new_window => |msg| try self.newWindow(rt_app, msg),
.close => |surface| try self.closeSurface(surface),
.quit => try self.setQuit(),
@@ -196,6 +197,12 @@ fn drainMailbox(self: *App, rt_app: *apprt.App) !void {
}
}
pub fn openConfig(self: *App, rt_app: *apprt.App) !void {
_ = self;
log.debug("opening configuration", .{});
try rt_app.openConfig();
}
pub fn reloadConfig(self: *App, rt_app: *apprt.App) !void {
log.debug("reloading configuration", .{});
if (try rt_app.reloadConfig()) |new| {
@@ -274,6 +281,9 @@ pub const Message = union(enum) {
/// all the active surfaces.
reload_config: void,
// Open the configuration file
open_config: void,
/// Create a new terminal window.
new_window: NewWindow,