close window action

This commit is contained in:
Mitchell Hashimoto
2022-11-06 10:44:23 -08:00
parent 410b2b4486
commit be76bc6c1a
3 changed files with 12 additions and 2 deletions

View File

@ -764,6 +764,8 @@ fn keyCallback(
}, .{ .instant = {} });
win.app.wakeup();
},
.close_window => win.window.setShouldClose(true),
}
// Bindings always result in us ignoring the char if printable

View File

@ -159,9 +159,14 @@ pub const Config = struct {
try result.keybind.set.put(
alloc,
.{ .key = .up, .mods = .{ .super = true } },
.{ .key = .n, .mods = .{ .super = true } },
.{ .new_window = {} },
);
try result.keybind.set.put(
alloc,
.{ .key = .w, .mods = .{ .super = true } },
.{ .close_window = {} },
);
return result;
}

View File

@ -134,8 +134,11 @@ pub const Action = union(enum) {
/// Dev mode
toggle_dev_mode: void,
/// Open a new terminal window.
/// Open a new window
new_window: void,
/// Close the current window
close_window: void,
};
/// Trigger is the associated key state that can trigger an action.