systemd: move toplevel to separate scopes #795
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently
niri
creates a separate scope per spawn action matching the name of the executable.So for example launching the non flatpak version of
firefox
throughfuzzel
will result in this firefox instanceto run under a scope name
app-niri-fuzzel-<PID>.scope
.This can be problematic in combination with
xdg-portal
, which will use the scope name as a fallback for thenon accessible app id.
To solve this, this PR tries to mimic what
systemd-sway
does, moving toplevels to systemd scopes matching their app id.In addition to moving the process it also add slices like
systemd-sway
offers. This allows to override resourcelimits per app id slice.
The code is more a PoC and needs a major cleanup. The worst part is finding out all child pids that should also be moved to the new scope.