On Sun, Feb 12, 2023 at 9:27 AM Vladimir Kudrya <vladimir-...@yandex.ru> wrote:
> On 10/02/2023 12.51, Mantas Mikulėnas wrote: > > Also systemd.special manual recommends putting display servers into >> session.slice. But in case of a wayland compositor it is impossible to >> separate it from the apps, because the compositor handles keyboard >> shortcuts (which launch apps or launchers which launch apps). Is this >> recommendation even feasible for wayland? >> > Yes; the compositor can use systemd D-Bus API to launch apps in their own > .scopes underneath app.slice (or transient .services), as e.g. GNOME Shell > already does. > > (For a different use of the same API, see also how GNOME Terminal – or > libvte, I guess – launches each terminal tab in its own .scope. You can > forkbomb a single tab without significantly affecting the rest of the > system.) > > If one does not want to mess with dbus, is prefixing app commands in > compositor's configuration with `systemd-run --user --scope > --slice=app.slice ...` a valid alternative? > That should work, although if you're already using systemd then I don't think D-Bus is that big of a step. (It would also let you create a .scope for an existing PID, which systemd-run currently doesn't have an option to.) Looking at what libgnome-desktop <https://sources.debian.org/src/gnome-desktop/43.1-1/libgnome-desktop/gnome-systemd.c/?hl=113#L113> does, you probably also want to use -G (aka --collect, aka --property=CollectMode=inactive-or-failed). -- Mantas Mikulėnas