mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Allow always
in confirm-close-surface
config option
Signed-off-by: jay-dee7 <me@jsdp.dev>
This commit is contained in:
@ -236,7 +236,7 @@ const DerivedConfig = struct {
|
||||
clipboard_paste_protection: bool,
|
||||
clipboard_paste_bracketed_safe: bool,
|
||||
copy_on_select: configpkg.CopyOnSelect,
|
||||
confirm_close_surface: bool,
|
||||
confirm_close_surface: configpkg.ConfirmCloseSurface,
|
||||
cursor_click_to_move: bool,
|
||||
desktop_notifications: bool,
|
||||
font: font.SharedGridSet.DerivedConfig,
|
||||
@ -784,13 +784,19 @@ pub fn deactivateInspector(self: *Surface) void {
|
||||
/// True if the surface requires confirmation to quit. This should be called
|
||||
/// by apprt to determine if the surface should confirm before quitting.
|
||||
pub fn needsConfirmQuit(self: *Surface) bool {
|
||||
// If the child has exited then our process is certainly not alive.
|
||||
// We check this first to avoid the locking overhead below.
|
||||
if (self.child_exited) return false;
|
||||
|
||||
// If we are configured to not hold open surfaces explicitly, just
|
||||
// always say there is nothing alive.
|
||||
if (!self.config.confirm_close_surface) return false;
|
||||
// Contract:
|
||||
// always -> confirm always (even if the child process has exited)
|
||||
// true -> confirm only if we have child process running
|
||||
// false -> no need to confirm, just exit
|
||||
switch (self.config.confirm_close_surface) {
|
||||
.false => return false,
|
||||
.true => {
|
||||
if (self.child_exited) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
.always => {}
|
||||
}
|
||||
|
||||
// We have to talk to the terminal.
|
||||
self.renderer_state.mutex.lock();
|
||||
|
@ -29,6 +29,7 @@ pub const RepeatableString = Config.RepeatableString;
|
||||
pub const RepeatablePath = Config.RepeatablePath;
|
||||
pub const ShellIntegrationFeatures = Config.ShellIntegrationFeatures;
|
||||
pub const WindowPaddingColor = Config.WindowPaddingColor;
|
||||
pub const ConfirmCloseSurface = Config.ConfirmCloseSurface;
|
||||
|
||||
// Alternate APIs
|
||||
pub const CAPI = @import("config/CAPI.zig");
|
||||
|
@ -1306,7 +1306,7 @@ keybind: Keybinds = .{},
|
||||
|
||||
/// Confirms that a surface should be closed before closing it. This defaults to
|
||||
/// true. If set to false, surfaces will close without any confirmation.
|
||||
@"confirm-close-surface": bool = true,
|
||||
@"confirm-close-surface": ConfirmCloseSurface = ConfirmCloseSurface.true,
|
||||
|
||||
/// Whether or not to quit after the last surface is closed.
|
||||
///
|
||||
@ -5331,6 +5331,13 @@ pub const AutoUpdate = enum {
|
||||
download,
|
||||
};
|
||||
|
||||
/// See confirm-close-surface
|
||||
pub const ConfirmCloseSurface = enum {
|
||||
false,
|
||||
true,
|
||||
always,
|
||||
};
|
||||
|
||||
/// See theme
|
||||
pub const Theme = struct {
|
||||
light: []const u8,
|
||||
|
Reference in New Issue
Block a user