Update Gala Systemd services (#1692)

This commit is contained in:
Corentin Noël 2023-06-18 18:11:44 +02:00 committed by GitHub
parent 57542b2512
commit befba69203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 8 deletions

View File

@ -1,10 +1,10 @@
[Unit] [Unit]
Description=Gala on X11 Description=Gala
DefaultDependencies=no DefaultDependencies=no
Requisite=gnome-session-initialized.target Requisite=gnome-session-initialized.target
PartOf=gnome-session-initialized.target PartOf=gnome-session-initialized.target
Before=gnome-session-initialized.target Before=gnome-session-initialized.target
Requires=gala-x11.service Wants=io.elementary.gala@wayland.service
After=gala-x11.service Wants=io.elementary.gala@x11.service

View File

@ -0,0 +1,34 @@
[Unit]
Description=Gala on Wayland
# On wayland, force a session shutdown
OnFailure=gnome-session-shutdown.target
OnFailureJobMode=replace-irreversibly
CollectMode=inactive-or-failed
RefuseManualStart=on
RefuseManualStop=on
After=gnome-session-manager.target
Requisite=gnome-session-initialized.target
PartOf=gnome-session-initialized.target
Before=gnome-session-initialized.target
#NOTE: ConditionEnvironment works with systemd >= 246
ConditionEnvironment=XDG_SESSION_TYPE=%I
[Service]
Slice=session.slice
Type=notify
ExecStart=@bindir@/gala
# unset some environment variables that were set by the compositor and won't work now that the compositor is gone
ExecStopPost=-/bin/sh -c 'test "$SERVICE_RESULT" != "exec-condition" && systemctl --user unset-environment GNOME_SETUP_DISPLAY WAYLAND_DISPLAY DISPLAY XAUTHORITY'
# On wayland we cannot restart
Restart=no
# Kill any stubborn child processes after this long
TimeoutStopSec=5
# Lower down Gala's OOM score to avoid being killed by OOM-killer too early
OOMScoreAdjust=-1000

View File

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Gala on X11 Description=Gala on X11
# On X11, try to show the fail whale screen # On X11, try to show the GNOME Session Failed screen
OnFailure=gnome-session-failed.target OnFailure=gnome-session-failed.target
OnFailureJobMode=replace OnFailureJobMode=replace
CollectMode=inactive-or-failed CollectMode=inactive-or-failed
@ -13,16 +13,28 @@ Requisite=gnome-session-initialized.target
PartOf=gnome-session-initialized.target PartOf=gnome-session-initialized.target
Before=gnome-session-initialized.target Before=gnome-session-initialized.target
#NOTE: ConditionEnvironment works with systemd >= 246
ConditionEnvironment=XDG_SESSION_TYPE=%I
# Limit startup frequency more than the default # Limit startup frequency more than the default
StartLimitIntervalSec=15s StartLimitIntervalSec=15s
StartLimitBurst=3 StartLimitBurst=3
[Service] [Service]
Slice=session.slice
Type=notify Type=notify
ExecStart=@bindir@/gala ExecStart=@bindir@/gala
# On X11 we do not need to unset any variables
# On X11 we want to restart on-success (Alt+F2 + r) and on-failure.
Restart=always Restart=always
# Do not wait before restarting # Do not wait before restarting the shell
RestartSec=0ms RestartSec=0ms
# Kill any stubborn child processes after this long # Kill any stubborn child processes after this long
TimeoutStopSec=5 TimeoutStopSec=5
# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early
OOMScoreAdjust=-1000

View File

@ -50,15 +50,24 @@ if get_option('systemd')
unit_conf.set('bindir', bindir) unit_conf.set('bindir', bindir)
configure_file( configure_file(
input: 'gala-x11.service.in', input: 'gala@x11.service.in',
output: 'gala-x11.service', output: 'io.elementary.gala@x11.service',
install: true,
install_dir: systemd_userunitdir,
configuration: unit_conf
)
configure_file(
input: 'gala@wayland.service.in',
output: 'io.elementary.gala@wayland.service',
install: true, install: true,
install_dir: systemd_userunitdir, install_dir: systemd_userunitdir,
configuration: unit_conf configuration: unit_conf
) )
install_data( install_data(
'gala-x11.target', 'gala.target',
rename: 'io.elementary.gala.target',
install_dir: systemd_userunitdir install_dir: systemd_userunitdir
) )
endif endif