From a0a3c01e799212e14f01f9ea3f480c8955ba2c85 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: Sat, 7 Sep 2019 19:57:35 +0200 Subject: [PATCH] install a systemd user unit add a systemd --user unit/service file, so that one can run waybar as a --user systemd service. when the service is enabled, Waybar will start when the wayland-session.target is started. this feature is automatically enabled if systemd is found, but can be disabled with -Dsystemd=disabled --- meson.build | 7 +++++++ meson_options.txt | 1 + resources/waybar.service | 12 ++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 resources/waybar.service diff --git a/meson.build b/meson.build index 061994bb..33c3f5f7 100644 --- a/meson.build +++ b/meson.build @@ -62,6 +62,13 @@ libnlgen = dependency('libnl-genl-3.0', required: get_option('libnl')) libpulse = dependency('libpulse', required: get_option('pulseaudio')) libudev = dependency('libudev', required: get_option('libudev')) libmpdclient = dependency('libmpdclient', required: get_option('mpd')) +systemd = dependency('systemd', required: get_option('systemd')) + +if systemd.found() + user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir') + install_data('./resources/waybar.service', + install_dir: user_units_dir) +endif src_files = files( 'src/factory.cpp', diff --git a/meson_options.txt b/meson_options.txt index ef3d30e3..1b86b57a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,6 +2,7 @@ option('libcxx', type : 'boolean', value : false, description : 'Build with Clan option('libnl', type: 'feature', value: 'auto', description: 'Enable libnl support for network related features') option('libudev', type: 'feature', value: 'auto', description: 'Enable libudev support for udev related features') option('pulseaudio', type: 'feature', value: 'auto', description: 'Enable support for pulseaudio') +option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit') option('dbusmenu-gtk', type: 'feature', value: 'auto', description: 'Enable support for tray') option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') option('mpd', type: 'feature', value: 'auto', description: 'Enable support for the Music Player Daemon') diff --git a/resources/waybar.service b/resources/waybar.service new file mode 100644 index 00000000..5eee4aaf --- /dev/null +++ b/resources/waybar.service @@ -0,0 +1,12 @@ +[Unit] +Description=Highly customizable Wayland bar for Sway and Wlroots based compositors. +Documentation=https://github.com/Alexays/Waybar/wiki/ +PartOf=wayland-session.target + +[Service] +Type=dbus +BusName=fr.arouillard.waybar +ExecStart=/usr/bin/waybar + +[Install] +WantedBy=wayland-session.target