fix: start apps not in this service cgroup
This commit is contained in:
@@ -45,13 +45,27 @@ class AppProvider:
|
|||||||
return Box(name="slot-box", orientation="h", spacing=10, children=children)
|
return Box(name="slot-box", orientation="h", spacing=10, children=children)
|
||||||
|
|
||||||
def activate(self, item: DesktopApp) -> None:
|
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:
|
if item.command_line:
|
||||||
argv = [
|
argv = [
|
||||||
t for t in shlex.split(item.command_line) if not _FIELD_CODE_RE.match(t)
|
t for t in shlex.split(item.command_line) if not _FIELD_CODE_RE.match(t)
|
||||||
]
|
]
|
||||||
if argv:
|
if argv:
|
||||||
subprocess.Popen(argv, start_new_session=True)
|
subprocess.Popen(
|
||||||
|
[
|
||||||
|
"systemd-run",
|
||||||
|
"--quiet",
|
||||||
|
"--user",
|
||||||
|
"--scope",
|
||||||
|
"--collect",
|
||||||
|
"--",
|
||||||
|
*argv,
|
||||||
|
],
|
||||||
|
start_new_session=True,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
item.launch()
|
item.launch()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user