mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
refactor: attempted autoupdate configuration
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -109,6 +109,12 @@ class AppDelegate: NSObject,
|
||||
// Initial config loading
|
||||
configDidReload(ghostty)
|
||||
|
||||
updaterController.updater.updateCheckInterval = 60
|
||||
updaterController.updater.automaticallyChecksForUpdates =
|
||||
ghostty.config.autoUpdates == "check" || ghostty.config.autoUpdates == "download"
|
||||
updaterController.updater.automaticallyDownloadsUpdates =
|
||||
ghostty.config.autoUpdates == "download"
|
||||
|
||||
// Register our service provider. This must happen after everything is initialized.
|
||||
NSApp.servicesProvider = ServiceProvider()
|
||||
|
||||
|
@ -331,5 +331,16 @@ extension Ghostty {
|
||||
let newColor = isLightBackground ? backgroundColor.darken(by: 0.08) : backgroundColor.darken(by: 0.4)
|
||||
return Color(newColor)
|
||||
}
|
||||
|
||||
var autoUpdates: String {
|
||||
let defaultValue = "off"
|
||||
guard let config = self.config else { return defaultValue }
|
||||
|
||||
let key = "auto-updates"
|
||||
var value: UnsafePointer<Int8>? = nil
|
||||
guard ghostty_config_get(config, &value, key, UInt(key.count)) else { return defaultValue }
|
||||
guard let pointer = value else { return defaultValue }
|
||||
return String(cString: pointer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1161,6 +1161,13 @@ term: []const u8 = "xterm-ghostty",
|
||||
/// running. Defaults to an empty string if not set.
|
||||
@"enquiry-response": []const u8 = "",
|
||||
|
||||
/// This controls the automatic update functionality on macOS by setting the
|
||||
/// properties on the Squirrel automatic update component. By default this is
|
||||
/// set to "off" which doesn't do anything. The "check" option will automatically
|
||||
/// check for updates but will NOT download them, while as the "download" option
|
||||
/// will both check AND download updates automatically for the user.
|
||||
@"auto-updates": AutoUpdates = .off,
|
||||
|
||||
/// This is set by the CLI parser for deinit.
|
||||
_arena: ?ArenaAllocator = null,
|
||||
|
||||
@ -3640,3 +3647,10 @@ pub const LinuxCgroup = enum {
|
||||
always,
|
||||
@"single-instance",
|
||||
};
|
||||
|
||||
/// See auto-updates
|
||||
pub const AutoUpdates = enum {
|
||||
check,
|
||||
download,
|
||||
off,
|
||||
};
|
||||
|
Reference in New Issue
Block a user