Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gala Systemd services #1692

Merged
merged 2 commits into from Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/gala-x11.target → data/gala.target
@@ -1,10 +1,10 @@
[Unit]
Description=Gala on X11
Description=Gala
DefaultDependencies=no

Requisite=gnome-session-initialized.target
PartOf=gnome-session-initialized.target
Before=gnome-session-initialized.target

Requires=gala-x11.service
After=gala-x11.service
Wants=io.elementary.gala@wayland.service
tintou marked this conversation as resolved.
Show resolved Hide resolved
Wants=io.elementary.gala@x11.service
34 changes: 34 additions & 0 deletions data/gala@wayland.service.in
@@ -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

16 changes: 14 additions & 2 deletions data/gala-x11.service.in → data/gala@x11.service.in
@@ -1,6 +1,6 @@
[Unit]
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
OnFailureJobMode=replace
CollectMode=inactive-or-failed
Expand All @@ -13,16 +13,28 @@ 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

# Limit startup frequency more than the default
StartLimitIntervalSec=15s
StartLimitBurst=3

[Service]
Slice=session.slice
Type=notify
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
# Do not wait before restarting
# Do not wait before restarting the shell
RestartSec=0ms
# Kill any stubborn child processes after this long
TimeoutStopSec=5

# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed the rename here.

OOMScoreAdjust=-1000


15 changes: 12 additions & 3 deletions data/meson.build
Expand Up @@ -50,15 +50,24 @@ if get_option('systemd')
unit_conf.set('bindir', bindir)

configure_file(
input: 'gala-x11.service.in',
output: 'gala-x11.service',
input: 'gala@x11.service.in',
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_dir: systemd_userunitdir,
configuration: unit_conf
)

install_data(
'gala-x11.target',
'gala.target',
rename: 'io.elementary.gala.target',
install_dir: systemd_userunitdir
)
endif