macos: add "Check for Updates" action, menu item & key-binding support (#7361)

Resolve #7325
This commit is contained in:
Mitchell Hashimoto
2025-05-15 15:45:24 -07:00
committed by GitHub
10 changed files with 38 additions and 4 deletions

View File

@@ -444,6 +444,7 @@ pub fn performAction(
.close_all_windows => _ = try rt_app.performAction(.app, .close_all_windows, {}),
.toggle_quick_terminal => _ = try rt_app.performAction(.app, .toggle_quick_terminal, {}),
.toggle_visibility => _ = try rt_app.performAction(.app, .toggle_visibility, {}),
.check_for_updates => _ = try rt_app.performAction(.app, .check_for_updates, {}),
}
}

View File

@@ -255,6 +255,8 @@ pub const Action = union(Key) {
/// it needs to ring the bell. This is usually a sound or visual effect.
ring_bell,
check_for_updates,
/// Sync with: ghostty_action_tag_e
pub const Key = enum(c_int) {
quit,
@@ -301,6 +303,7 @@ pub const Action = union(Key) {
config_change,
close_window,
ring_bell,
check_for_updates,
};
/// Sync with: ghostty_action_u

View File

@@ -249,6 +249,7 @@ pub const App = struct {
.prompt_title,
.reset_window_size,
.ring_bell,
.check_for_updates,
=> {
log.info("unimplemented action={}", .{action});
return false;

View File

@@ -504,6 +504,7 @@ pub fn performAction(
.renderer_health,
.color_change,
.reset_window_size,
.check_for_updates,
=> {
log.warn("unimplemented action={}", .{action});
return false;

View File

@@ -509,6 +509,11 @@ pub const Action = union(enum) {
/// This currently only works on macOS.
toggle_visibility,
/// Check for updates.
///
/// This currently only works on macOS.
check_for_updates,
/// Quit ghostty.
quit,
@@ -791,6 +796,7 @@ pub const Action = union(enum) {
.quit,
.toggle_quick_terminal,
.toggle_visibility,
.check_for_updates,
=> .app,
// These are app but can be special-cased in a surface context.

View File

@@ -364,6 +364,12 @@ fn actionCommands(action: Action.Key) []const Command {
.description = "Toggle secure input mode.",
}},
.check_for_updates => comptime &.{.{
.action = .check_for_updates,
.title = "Check for Updates",
.description = "Check for updates to the application.",
}},
.quit => comptime &.{.{
.action = .quit,
.title = "Quit",