Verified Commit 215e654c authored by Iain Lane's avatar Iain Lane

Add systemd user units

The structure is like this:

  - gnome-session-wayland.target, gnome-session-x11.target: Top-level
    targets launched directly to start the regular GNOME (Shell) session
    for wayland or x11 respectively.
  - gnome-session@.service: Execute gnome-session-binary tself for the
    specified (template) session. Is active once
    org.gnome.SessionManager is claimed on the bus.
  - gnome-session-bus.target: Bound to gnome-session@.service - if
    something needs to start after any instance of gnome-session@
    starts, it can be After= this one. gnome-settings-daemon uses this.

We also split out gnome-wayland.desktop.in, as it is going to need to
launch gnome-session-wayland.target.
parent 142592d4
[Unit]
Description=gnome-session is on the bus
StopWhenUnneeded=yes
[Unit]
Description=User systemd services for the GNOME graphical session (wayland)
Requires=graphical-session-pre.target
# start/tear down graphical-session.target along with the gnome session
BindsTo=graphical-session.target
# session leader -- if this dies, die along with it
BindsTo=gnome-session@gnome.service
Wants=gnome-settings-daemon-wayland.target gnome-shell-wayland.target
[Unit]
Description=User systemd services for the GNOME graphical session (x11)
Requires=graphical-session-pre.target
# start/tear down graphical-session.target along with the gnome session
BindsTo=graphical-session.target
# session leader -- if this dies, die along with it
BindsTo=gnome-session@gnome.service
Wants=gnome-settings-daemon-x11.target gnome-shell-x11.target
[Unit]
Description=GNOME Session Manager (%i session)
PartOf=graphical-session.target
After=graphical-session-pre.target
Before=gnome-settings-daemon.target gnome-session-bus.target
BindsTo=gnome-session-bus.target
[Service]
Type=dbus
ExecStart=@libexecdir@/gnome-session-binary --ignore-required-components --session=%i
BusName=org.gnome.SessionManager
[Desktop Entry]
Name=GNOME
Comment=This session logs you into GNOME
Exec=@bindir@/gnome-session
TryExec=@bindir@/gnome-session
Type=Application
DesktopNames=GNOME
desktop_plain = 'gnome'
# We'd like to have gnome-wayland have output: 'gnome.desktop', but this
# doesn't work https://github.com/mesonbuild/meson/issues/3759 So this is later
# renamed in meson_post_install.py
desktops = [
desktop_plain,
'gnome-xorg'
['gnome', 'xsessions'],
['gnome-xorg', 'xsessions'],
['gnome-wayland', 'wayland-sessions']
]
if enable_session_selector
desktops += 'gnome-custom-session'
desktops += ['gnome-custom-session', 'xsessions']
endif
foreach name: desktops
desktop_conf = configuration_data()
desktop_conf.set('bindir', session_bindir)
desktop = name + '.desktop'
desktop = name[0] + '.desktop'
dir = name[1]
desktop_in = configure_file(
input: desktop + '.in.in',
......@@ -21,25 +24,14 @@ foreach name: desktops
configuration: desktop_conf
)
install_dir = join_paths(session_datadir, 'xsessions')
# FIXME: The same target can not be copied into two directories.
# There is a workaround in meson_post_install.py until proper solution arises:
# https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
if name == desktop_plain
#install_dir: [
# join_paths(session_datadir, 'xsessions'),
# join_paths(session_datadir, 'wayland-sessions')
#]
endif
desktop_target = i18n.merge_file(
i18n.merge_file(
desktop,
type: 'desktop',
input: desktop_in,
output: desktop,
po_dir: po_dir,
install: true,
install_dir: install_dir
install_dir: join_paths(session_datadir, dir)
)
endforeach
......@@ -88,6 +80,29 @@ install_data(
install_dir: join_paths(session_datadir, 'GConf', 'gsettings')
)
unit_conf = configuration_data()
unit_conf.set('libexecdir', session_libexecdir)
dep_systemd = dependency('systemd', required: true)
systemd_userunitdir = dep_systemd.get_pkgconfig_variable('systemduserunitdir')
configure_file(
input: 'gnome-session@.service.in',
output: 'gnome-session@.service',
install: true,
install_dir: systemd_userunitdir,
configuration: unit_conf
)
systemd_target = files('gnome-session-bus.target',
'gnome-session-wayland.target',
'gnome-session-x11.target')
install_data(
systemd_target,
install_dir: systemd_userunitdir
)
data = files('hardware-compatibility')
if enable_session_selector
......
......@@ -15,12 +15,7 @@ if not os.environ.get('DESTDIR'):
print('Compile gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
# FIXME: this is due to unable to copy a generated target file:
# https://groups.google.com/forum/#!topic/mesonbuild/3iIoYPrN4P0
dst_dir = os.path.join(install_root, 'wayland-sessions')
if not os.path.exists(dst_dir):
os.makedirs(dst_dir)
src = os.path.join(install_root, 'xsessions', 'gnome.desktop')
dst = os.path.join(dst_dir, 'gnome.desktop')
shutil.copyfile(src, dst)
os.rename(os.path.join(dst_dir, 'gnome-wayland.desktop'),
os.path.join(dst_dir, 'gnome.desktop'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment