Add Dbus activation service and systemd unit file (#50)

* Provide dbus and systemd service files by default

* Split ExecReload command in two, since swaync-client only handles one argument per run.

Co-authored-by: nightly-brew <>
This commit is contained in:
nightly brew 2022-01-05 18:54:09 +00:00 committed by GitHub
parent 98c5fb7e09
commit 4e35be8626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

View File

@ -7,6 +7,35 @@ project('sway-notificaton-center', ['c', 'vala'],
subdir('src')
datadir = get_option('datadir')
libdir = get_option('libdir')
conf_data = configuration_data()
conf_data.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
# Dbus service
configure_file(
configuration: conf_data,
input: 'services/dbus/org.erikreider.swaync.service.in',
output: '@BASENAME@',
install_dir: datadir + '/dbus-1/services'
)
# Systemd service unit
systemd = dependency('systemd', required: false)
if get_option('systemd-service')
if systemd.found()
systemd_service_install_dir = systemd.get_pkgconfig_variable('systemduserunitdir')
else
systemd_service_install_dir = join_paths(libdir, 'systemd', 'user')
endif
configure_file(
configuration: conf_data,
input: 'services/systemd/swaync.service.in',
output: '@BASENAME@',
install_dir: systemd_service_install_dir
)
endif
# Zsh completion
if get_option('zsh-completions')

View File

@ -1,3 +1,4 @@
option('systemd-service', type: 'boolean', value: true, description: 'Install systemd user service unit.')
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')

View File

@ -0,0 +1,4 @@
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=@bindir@/swaync
SystemdService=swaync.service

View File

@ -0,0 +1,18 @@
[Unit]
Description=Swaync notification daemon
Documentation=https://github.com/ErikReider/SwayNotificationCenter
PartOf=graphical-session.target
After=graphical-session.target
Requisite=graphical-session.target
# ConditionEnvironment requires systemd v247 to work correctly
ConditionEnvironment=WAYLAND_DISPLAY
[Service]
Type=dbus
BusName=org.freedesktop.Notifications
ExecStart=@bindir@/swaync
ExecReload=@bindir@/swaync-client --reload-config && @bindir@/swaync-client --reload-css
Restart=on-failure
[Install]
WantedBy=graphical-session.target