Launch apps in their own scope instead of the compositor's cgroup (#6541)

* Launch apps in their own scope instead of the compositor's cgroup

The launcher ran desktop entries through gtk-launch, so the app inherited
quickshell's cgroup, which belongs to wayland-wm@hyprland.desktop.service.
A kernel OOM kill there fails the compositor unit and tears down the whole
session, dropping the user at SDDM with every window lost. A single runaway
app took the desktop down three times in one afternoon.

Route launches through uwsm-app so each app gets its own scope under
app-graphical.slice. A runaway app now fails its own scope and the session
keeps running.

The post-install launches had the same inheritance bug in a milder form,
where the app landed in the installer terminal's scope and died with it.
0aedef58 patched that with setsid, which detaches the session but leaves
cgroup membership behind. A scope fixes it properly.

* Detach post-install app launches

* Preserve desktop entry launch compatibility

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
Diogo Ferreira
2026-08-04 12:16:54 -05:00
committed by GitHub
co-authored by David Heinemeier Hansson
parent fe55ac264d
commit 40f92eabdf
9 changed files with 118 additions and 14 deletions
+5 -4
View File
@@ -78,10 +78,11 @@ Item {
var id = String(desktopId || "")
if (!id) return
root.beginLaunchFeedback(name)
// Pass the file name with its extension: gtk-launch only appends ".desktop"
// when the argument doesn't already end with it, so ids that themselves end
// in ".desktop" (e.g. org.telegram.desktop) would otherwise never resolve.
Util.execDetached("gtk-launch " + Util.shellQuote(id + ".desktop"))
// Start gtk-launch inside a scope under app-graphical.slice so apps do not
// inherit wayland-wm@.service. Keeping gtk-launch as the desktop-entry
// resolver supports IDs with spaces and entries that UWSM rejects.
// Keep the .desktop suffix or ids like org.telegram.desktop won't resolve.
Util.execDetached("uwsm-app -- gtk-launch " + Util.shellQuote(id + ".desktop"))
}
function remove(desktopId, name) {