config: control cgroup isolation

This commit is contained in:
Mitchell Hashimoto
2024-06-05 09:43:57 -07:00
parent 7d9da34259
commit ad5d44af10
3 changed files with 55 additions and 12 deletions

View File

@@ -988,6 +988,30 @@ keybind: Keybinds = .{},
/// This does not work with GLFW builds.
@"macos-option-as-alt": OptionAsAlt = .false,
/// Put every surface (tab, split, window) into a dedicated Linux cgroup.
///
/// This makes it so that resource management can be done on a per-surface
/// granularity. For example, if a shell program is using too much memory,
/// only that shell will be killed by the oom monitor instead of the entire
/// Ghostty process. Similarly, if a shell program is using too much CPU,
/// only that surface will be CPU-throttled.
///
/// This will cause startup times to be slower (a hundred milliseconds or so),
/// so the default value is "single-instance." In single-instance mode, only
/// one instance of Ghostty is running (see gtk-single-instance) so the startup
/// time is a one-time cost. Additionally, single instance Ghostty is much
/// more likely to have many windows, tabs, etc. so cgroup isolation is a
/// big benefit.
///
/// Valid values are:
///
/// * `never` - Never use cgroups.
/// * `always` - Always use cgroups.
/// * `single-instance` - Enable cgroups only for Ghostty instances launched
/// as single-instance applications (see gtk-single-instance).
///
@"linux-cgroup": LinuxCgroup = .@"single-instance",
/// If true, the Ghostty GTK application will run in single-instance mode:
/// each new `ghostty` process launched will result in a new window if there
/// is already a running process.
@@ -3495,3 +3519,10 @@ pub const GraphemeWidthMethod = enum {
legacy,
unicode,
};
/// See linux-cgroup
pub const LinuxCgroup = enum {
never,
always,
@"single-instance",
};