From 510aafca7541754fc03765ecad3dcf2482591f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=98=D0=B0=D0=BD=20=D0=93=D0=B5=D0=BE?= =?UTF-8?q?=D1=80=D0=B3=D0=B8=D0=B5=D0=B2=D1=81=D0=BA=D0=B8?= Date: Mon, 21 Jan 2019 23:56:52 +0100 Subject: [PATCH] systemd --user support files * adds a sway-session.target that binds to graphical-session.target (see man systemd.special) * also adds a 10-systemd script that should (must?) be included from sway that starts imports the sway environment variables into the systemd --user instance, and then starts sway-session.target The idea is that, any --user units that are wanted by either sway-session.target or graphical-session.target will be started when sway runs, and will have the correct environment from sway too. --- meson.build | 3 +++ systemd/10-systemd | 4 ++++ systemd/meson.build | 15 +++++++++++++++ systemd/sway-session.target | 7 +++++++ 4 files changed, 29 insertions(+) create mode 100644 systemd/10-systemd create mode 100644 systemd/meson.build create mode 100644 systemd/sway-session.target diff --git a/meson.build b/meson.build index 766bf012f..1f5fdae43 100644 --- a/meson.build +++ b/meson.build @@ -153,6 +153,9 @@ subdir('client') subdir('swaybg') subdir('swaybar') subdir('swaynag') +if systemd.found() + subdir('systemd') +endif config = configuration_data() config.set('datadir', join_paths(prefix, datadir)) diff --git a/systemd/10-systemd b/systemd/10-systemd new file mode 100644 index 000000000..352aed6fa --- /dev/null +++ b/systemd/10-systemd @@ -0,0 +1,4 @@ +# should go to /etc/sway/config.d/10-systemd +# +exec systemctl --user import-environment +exec systemctl --user start sway-session.target diff --git a/systemd/meson.build b/systemd/meson.build new file mode 100644 index 000000000..6df652386 --- /dev/null +++ b/systemd/meson.build @@ -0,0 +1,15 @@ +systemd_dep = dependency('systemd') + +if systemd_dep.found() + systemd_units = files( + 'sway-session.target', + ) + user_units_dir = systemd_dep.get_pkgconfig_variable('systemduserunitdir') + install_data(systemd_units, install_dir: user_units_dir) + + sway_systemd_scripts = files( + '10-systemd', + ) + + install_data(sway_systemd_scripts, install_dir: sysconfdir + '/sway/config.d') +endif diff --git a/systemd/sway-session.target b/systemd/sway-session.target new file mode 100644 index 000000000..db9496766 --- /dev/null +++ b/systemd/sway-session.target @@ -0,0 +1,7 @@ +[Unit] +Description=sway compositor session +Documentation=man:systemd.special(7) +BindsTo=graphical-session.target +Wants=graphical-session-pre.target +After=graphical-session-pre.target +