config: "-e" implies quit after last window closed

Fixes #2220
This commit is contained in:
Mitchell Hashimoto
2024-09-13 20:57:43 -07:00
parent 779b721618
commit a9217bd9da

View File

@ -513,9 +513,16 @@ palette: Palette = .{},
/// ///
/// If you're using the `ghostty` CLI there is also a shortcut to run a command /// If you're using the `ghostty` CLI there is also a shortcut to run a command
/// with arguments directly: you can use the `-e` flag. For example: `ghostty -e /// with arguments directly: you can use the `-e` flag. For example: `ghostty -e
/// fish --with --custom --args`. The `-e` flag also automatically sets /// fish --with --custom --args`. The `-e` flag automatically forces some
/// `gtk-single-instance = false` (no matter what) to ensure that a new /// other behaviors as well:
/// instance is launched and the CLI args are respected. ///
/// * `gtk-single-instance=false` - This ensures that a new instance is
/// launched and the CLI args are respected.
///
/// * `quit-after-last-window-closed=true` - This ensures that the Ghostty
/// process will exit when the command exits. Additionally, the
/// `quit-after-last-window-closed-delay` is unset.
///
command: ?[]const u8 = null, command: ?[]const u8 = null,
/// If true, keep the terminal open after the command exits. Normally, the /// If true, keep the terminal open after the command exits. Normally, the
@ -2543,10 +2550,10 @@ pub fn parseManuallyHook(self: *Config, alloc: Allocator, arg: []const u8, iter:
self.command = command.items[0 .. command.items.len - 1]; self.command = command.items[0 .. command.items.len - 1];
// When "-e" is used on the command line then we always disabled // See "command" docs for the implied configurations and why.
// single instance mode because single instance mode is incompatible
// with CLI flags.
self.@"gtk-single-instance" = .false; self.@"gtk-single-instance" = .false;
self.@"quit-after-last-window-closed" = true;
self.@"quit-after-last-window-closed-delay" = null;
// Do not continue, we consumed everything. // Do not continue, we consumed everything.
return false; return false;