<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 10, 2023 at 12:27 PM Vladimir Kudrya <<a href="mailto:vladimir-csp@yandex.ru">vladimir-csp@yandex.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <div>On 10/02/2023 12.51, Mantas Mikulėnas
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="auto">
        <div class="gmail_quote">
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div>
              <p>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?<br>
              </p>
            </div>
          </blockquote>
        </div>
        <div dir="auto">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.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">(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.)</div>
      </div>
    </blockquote>
    <p>That would put unneeded work on compositors, some of which might
      never even care about systemd.</p>
    <p>I wonder if there is a potential centralized solution on session
      manager side, like configuring a unit to automatically put any
      forked processes into scopes of chosen slice.</p>
    <pre># in <a href="mailto:wayland-wm@.service" target="_blank">wayland-wm@.service</a>:
...
[Service]
...
Slice=session.slice
# hypothetical new feature
ScopeForksTo=app.slice
...
</pre>
  </div>

</blockquote></div><div><br></div><div>Systemd has no way to control where child processes of some other process will go, nor can it distinguish child processes that are "apps" from child processes that are used by the WM itself.<br></div><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>