mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
apprt/gtk: store transient cgroup
This commit is contained in:
@ -62,6 +62,11 @@ running: bool = true,
|
|||||||
/// Xkb state (X11 only). Will be null on Wayland.
|
/// Xkb state (X11 only). Will be null on Wayland.
|
||||||
x11_xkb: ?x11.Xkb = null,
|
x11_xkb: ?x11.Xkb = null,
|
||||||
|
|
||||||
|
/// The base path of the transient cgroup used to put all surfaces
|
||||||
|
/// into their own cgroup. This is only set if cgroups are enabled
|
||||||
|
/// and initialization was successful.
|
||||||
|
transient_cgroup_base: ?[]const u8 = null,
|
||||||
|
|
||||||
pub fn init(core_app: *CoreApp, opts: Options) !App {
|
pub fn init(core_app: *CoreApp, opts: Options) !App {
|
||||||
_ = opts;
|
_ = opts;
|
||||||
|
|
||||||
@ -281,6 +286,7 @@ pub fn terminate(self: *App) void {
|
|||||||
|
|
||||||
if (self.cursor_none) |cursor| c.g_object_unref(cursor);
|
if (self.cursor_none) |cursor| c.g_object_unref(cursor);
|
||||||
if (self.menu) |menu| c.g_object_unref(menu);
|
if (self.menu) |menu| c.g_object_unref(menu);
|
||||||
|
if (self.transient_cgroup_base) |path| self.core_app.alloc.free(path);
|
||||||
|
|
||||||
self.config.deinit();
|
self.config.deinit();
|
||||||
}
|
}
|
||||||
@ -381,9 +387,9 @@ pub fn run(self: *App) !void {
|
|||||||
|
|
||||||
// If we are running, then we proceed to setup our app.
|
// If we are running, then we proceed to setup our app.
|
||||||
|
|
||||||
// Setup our cgroup configurations for our tabs.
|
// Setup our cgroup configurations for our surfaces.
|
||||||
if (cgroup.init(self)) |cgroup_path| {
|
if (cgroup.init(self)) |cgroup_path| {
|
||||||
self.core_app.alloc.free(cgroup_path);
|
self.transient_cgroup_base = cgroup_path;
|
||||||
} else |err| {
|
} else |err| {
|
||||||
// If we can't initialize cgroups then that's okay. We
|
// If we can't initialize cgroups then that's okay. We
|
||||||
// want to continue to run so we just won't isolate surfaces.
|
// want to continue to run so we just won't isolate surfaces.
|
||||||
|
@ -36,6 +36,7 @@ pub fn init(app: *App) ![]const u8 {
|
|||||||
pid,
|
pid,
|
||||||
) orelse "";
|
) orelse "";
|
||||||
if (!std.mem.eql(u8, original, current)) break :transient current;
|
if (!std.mem.eql(u8, original, current)) break :transient current;
|
||||||
|
alloc.free(current);
|
||||||
std.time.sleep(25 * std.time.ns_per_ms);
|
std.time.sleep(25 * std.time.ns_per_ms);
|
||||||
};
|
};
|
||||||
errdefer alloc.free(transient);
|
errdefer alloc.free(transient);
|
||||||
|
Reference in New Issue
Block a user