From d14a0c96780f2964faabc6644525f91694d2fe12 Mon Sep 17 00:00:00 2001 From: Makesesama Date: Tue, 5 May 2026 20:50:18 +0200 Subject: [PATCH] fix: start apps not in this service cgroup --- sims/modules/launcher/apps.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sims/modules/launcher/apps.py b/sims/modules/launcher/apps.py index de63d40..c98d3a7 100644 --- a/sims/modules/launcher/apps.py +++ b/sims/modules/launcher/apps.py @@ -45,13 +45,27 @@ class AppProvider: return Box(name="slot-box", orientation="h", spacing=10, children=children) def activate(self, item: DesktopApp) -> None: - # Detach from sims's session so apps survive sims shutdown. + # Launch in a transient systemd --user scope so the app gets its own + # cgroup instead of inheriting sims.service's. start_new_session alone + # only changes POSIX session/pgid; systemd tracks units by cgroup and + # would kill children with sims on stop (default KillMode=control-group). if item.command_line: argv = [ t for t in shlex.split(item.command_line) if not _FIELD_CODE_RE.match(t) ] if argv: - subprocess.Popen(argv, start_new_session=True) + subprocess.Popen( + [ + "systemd-run", + "--quiet", + "--user", + "--scope", + "--collect", + "--", + *argv, + ], + start_new_session=True, + ) return item.launch()