From d09bac64aec6e8ef0ce84d3383ae19b94cbf1848 Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Sun, 28 Dec 2025 15:39:29 +0100 Subject: [PATCH] Remove systemd integration from nautilus extension As far as I understand ghostty integrates with systemd already nowadays, and manages its own scopes/cgroups for tabs. As such, explicitly moving launching ghostty into a separate systemd scope from nautilus no longer seems necessary. --- dist/linux/ghostty_nautilus.py | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/dist/linux/ghostty_nautilus.py b/dist/linux/ghostty_nautilus.py index 42c397642..4f13dd617 100644 --- a/dist/linux/ghostty_nautilus.py +++ b/dist/linux/ghostty_nautilus.py @@ -19,39 +19,13 @@ from os.path import isdir from gi import require_version -from gi.repository import Nautilus, GObject, Gio, GLib +from gi.repository import Nautilus, GObject, Gio class OpenInGhosttyAction(GObject.GObject, Nautilus.MenuProvider): - def __init__(self): - super().__init__() - session = Gio.bus_get_sync(Gio.BusType.SESSION, None) - self._systemd = None - # Check if the this system runs under systemd, per sd_booted(3) - if isdir('/run/systemd/system/'): - self._systemd = Gio.DBusProxy.new_sync(session, - Gio.DBusProxyFlags.NONE, - None, - "org.freedesktop.systemd1", - "/org/freedesktop/systemd1", - "org.freedesktop.systemd1.Manager", None) - def _open_terminal(self, path): cmd = ['ghostty', f'--working-directory={path}', '--gtk-single-instance=false'] - child = Gio.Subprocess.new(cmd, Gio.SubprocessFlags.NONE) - if self._systemd: - # Move new terminal into a dedicated systemd scope to make systemd - # track the terminal separately; in particular this makes systemd - # keep a separate CPU and memory account for the terminal which in turn - # ensures that oomd doesn't take nautilus down if a process in - # ghostty consumes a lot of memory. - pid = int(child.get_identifier()) - props = [("PIDs", GLib.Variant('au', [pid])), - ('CollectMode', GLib.Variant('s', 'inactive-or-failed'))] - name = 'app-nautilus-com.mitchellh.ghostty-{}.scope'.format(pid) - args = GLib.Variant('(ssa(sv)a(sa(sv)))', (name, 'fail', props, [])) - self._systemd.call_sync('StartTransientUnit', args, - Gio.DBusCallFlags.NO_AUTO_START, 500, None) + Gio.Subprocess.new(cmd, Gio.SubprocessFlags.NONE) def _menu_item_activated(self, _menu, paths): for path in paths: