Skip to content

session: Add a drop-in for the application scopes cinnamon creates - #213

Open
Fantu wants to merge 1 commit into
linuxmint:masterfrom
Fantu:app-scope-dropin
Open

session: Add a drop-in for the application scopes cinnamon creates#213
Fantu wants to merge 1 commit into
linuxmint:masterfrom
Fantu:app-scope-dropin

Conversation

@Fantu

@Fantu Fantu commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

With linuxmint/cinnamon-desktop#275, cinnamon puts every application it launches into a transient app-cinnamon-*.scope. Those scopes are created with nothing but a PID list, so systemd knows nothing about their lifetime: at logout they are torn down abruptly when the user instance goes away, and if the user has lingering enabled they are not torn down at all.

This ships the same drop-in gnome-session ships for its own scopes (data/app-override.scope.conf, installed into app-gnome-.scope.d/):

  • PartOf=graphical-session.target ties the applications to the session, so they are stopped when it ends instead of being killed when the user instance goes down.
  • TimeoutStopSec=5s gives them a moment to exit cleanly first.
  • CollectMode=inactive-or-failed keeps failed units from piling up.

This relies on graphical-session.target being activated by the session, which has been the case since e01c8c3 (#204).

Testing

Mint 23, Cinnamon 6.7.4 with the cinnamon-desktop fix applied — the drop-in is picked up by the scopes as they are created:

$ systemctl --user show app-cinnamon-debian-xterm-18470.scope \
      -p PartOf -p CollectMode -p TimeoutStopUSec -p Slice
PartOf=graphical-session.target
CollectMode=inactive-or-failed
TimeoutStopUSec=5s
Slice=app.slice

One caveat worth stating

graphical-session.target belongs to the systemd user instance, which is per user, not per session. If the same user has two graphical sessions running at once, logging out of one stops the application scopes of the other as well. Before application scopes existed the applications lived in their own session-N.scope and were unaffected. This is the same trade-off GNOME makes, and the multi-session case is rare, but it is a real behaviour change.

Cinnamon puts every application it launches into a transient
app-cinnamon-*.scope. Those scopes are created with just a PID list, so
by default systemd knows nothing about their lifetime: on logout they
are torn down abruptly when the user instance goes away, and if the user
has lingering enabled they are not torn down at all.

Ship the same drop-in gnome-session ships for its own scopes:
PartOf=graphical-session.target ties them to the session, TimeoutStopSec
gives applications a moment to exit before being killed, and CollectMode
keeps failed units from piling up.

This relies on graphical-session.target being activated by the session,
which is the case since commit e01c8c3.

Assisted-by: Claude Code:claude-opus-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant