change background-timeout to quit-after-last-window-closed-delay

This commit is contained in:
Jeffrey C. Ollie
2024-07-30 15:20:43 -05:00
parent 46264cbe7c
commit eb3b2588bf
2 changed files with 10 additions and 10 deletions

View File

@ -282,8 +282,8 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
const css_provider = c.gtk_css_provider_new(); const css_provider = c.gtk_css_provider_new();
try loadRuntimeCss(&config, css_provider); try loadRuntimeCss(&config, css_provider);
// Run a small no-op function so that we don't get stuck in // Run a small no-op function every 500 milliseconds so that we don't get
// g_main_context_iteration forever if there are no open surfaces. // stuck in g_main_context_iteration forever if there are no open surfaces.
_ = c.g_timeout_add(500, gtkTimeout, null); _ = c.g_timeout_add(500, gtkTimeout, null);
return .{ return .{
@ -517,7 +517,7 @@ pub fn run(self: *App) !void {
// If the background timeout is not null, check to see // If the background timeout is not null, check to see
// if the timeout has elapsed. // if the timeout has elapsed.
if (self.config.@"background-timeout".duration) |duration| { if (self.config.@"quit-after-last-window-closed-delay".duration) |duration| {
const now = try std.time.Instant.now(); const now = try std.time.Instant.now();
if (now.since(last_one) > duration) if (now.since(last_one) > duration)

View File

@ -896,11 +896,11 @@ else switch (builtin.os.tag) {
/// If `quit-after-last-window-closed` is set to `after-timeout`, this controls /// If `quit-after-last-window-closed` is set to `after-timeout`, this controls
/// how long Ghostty will stay running after the last open surface has been /// how long Ghostty will stay running after the last open surface has been
/// closed. If the `background-timeout` is unset Ghostty will remain running /// closed. If `quit-after-last-window-closed-delay` is unset Ghostty will
/// indefinitely. The duration should be long enough to allow Ghostty to /// remain running indefinitely. The duration should be long enough to allow
/// initialize and open it's first window. The duration is specified as a series /// Ghostty to initialize and open it's first window. The duration is specified
/// of numbers followed by time units. Whitespace is allowed between numbers and /// as a series of numbers followed by time units. Whitespace is allowed between
/// units. The allowed time units are as follows: /// numbers and units. The allowed time units are as follows:
/// ///
/// * `y` - 365 SI days, or 8760 hours, or 31536000 seconds. No adjustments /// * `y` - 365 SI days, or 8760 hours, or 31536000 seconds. No adjustments
/// are made for leap years or leap seconds. /// are made for leap years or leap seconds.
@ -918,10 +918,10 @@ else switch (builtin.os.tag) {
/// ///
/// The maximum value is `584y 49w 23h 34m 33s 709ms 551µs 615ns`. /// The maximum value is `584y 49w 23h 34m 33s 709ms 551µs 615ns`.
/// ///
/// By default the `background-timeout` is set to five minutes. /// By default `quit-after-last-window-closed-delay` is set to five minutes.
/// ///
/// Only implemented on Linux. /// Only implemented on Linux.
@"background-timeout": Duration = .{ .duration = 5 * std.time.ns_per_min }, @"quit-after-last-window-closed-delay": Duration = .{ .duration = 5 * std.time.ns_per_min },
/// Whether to enable shell integration auto-injection or not. Shell integration /// Whether to enable shell integration auto-injection or not. Shell integration
/// greatly enhances the terminal experience by enabling a number of features: /// greatly enhances the terminal experience by enabling a number of features: