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 +