diff options
-rw-r--r-- | .builds/archlinux.yml | 2 | ||||
-rw-r--r-- | include/swaybar/tray/tray.h | 4 | ||||
-rw-r--r-- | meson.build | 32 | ||||
-rw-r--r-- | meson_options.txt | 1 | ||||
-rw-r--r-- | swaybar/meson.build | 6 |
5 files changed, 29 insertions, 16 deletions
diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml index dfe1900e..ad47a9c9 100644 --- a/.builds/archlinux.yml +++ b/.builds/archlinux.yml @@ -24,7 +24,7 @@ tasks: sudo ninja -C build install - setup: | cd sway - meson build -Dauto_features=enabled + meson build -Dauto_features=enabled -Dsd-bus-provider=libsystemd - build: | cd sway ninja -C build diff --git a/include/swaybar/tray/tray.h b/include/swaybar/tray/tray.h index 8958b69a..b5df0025 100644 --- a/include/swaybar/tray/tray.h +++ b/include/swaybar/tray/tray.h @@ -2,9 +2,9 @@ #define _SWAYBAR_TRAY_TRAY_H #include "config.h" -#ifdef HAVE_SYSTEMD +#ifdef HAVE_LIBSYSTEMD #include <systemd/sd-bus.h> -#elif HAVE_ELOGIND +#elif HAVE_LIBELOGIND #include <elogind/sd-bus.h> #endif #include <cairo.h> diff --git a/meson.build b/meson.build index ee2fdaaa..9842d78a 100644 --- a/meson.build +++ b/meson.build @@ -51,8 +51,6 @@ pixman = dependency('pixman-1') glesv2 = dependency('glesv2') libevdev = dependency('libevdev') libinput = dependency('libinput', version: '>=1.6.0') -systemd = dependency('libsystemd', version: '>=239', required: false) -elogind = dependency('libelogind', version: '>=239', required: false) xcb = dependency('xcb', required: get_option('xwayland')) bash_comp = dependency('bash-completion', required: false) fish_comp = dependency('fish', required: false) @@ -93,9 +91,28 @@ if get_option('xwayland').enabled() and not wlroots_features['xwayland'] endif have_xwayland = xcb.found() and wlroots_features['xwayland'] -tray_deps_found = systemd.found() or elogind.found() +if get_option('sd-bus-provider') == 'auto' + if not get_option('tray').disabled() + assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') + endif + sdbus = dependency('libsystemd', + required: false, + version: '>=239', + not_found_message: 'libsystemd not found, trying libelogind', + ) + if not sdbus.found() + sdbus = dependency('libelogind', + required: false, + version: '>=239', + ) + endif +else + sdbus = dependency(get_option('sd-bus-provider'), required: get_option('tray')) +endif + +tray_deps_found = sdbus.found() if get_option('tray').enabled() and not tray_deps_found - error('Building with -Dtray=enabled, but libsystemd and libelogind have not been not found') + error('Building with -Dtray=enabled, but sd-bus has not been not found') endif have_tray = (not get_option('tray').disabled()) and tray_deps_found @@ -103,8 +120,8 @@ conf_data = configuration_data() conf_data.set10('HAVE_XWAYLAND', have_xwayland) conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found()) -conf_data.set10('HAVE_SYSTEMD', systemd.found()) -conf_data.set10('HAVE_ELOGIND', elogind.found()) +conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd') +conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind') conf_data.set10('HAVE_TRAY', have_tray) scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages')) @@ -291,8 +308,7 @@ endif summary({ 'xwayland': have_xwayland, 'gdk-pixbuf': gdk_pixbuf.found(), - 'systemd': systemd.found(), - 'elogind': elogind.found(), + 'sd-bus': sdbus.found(), 'tray': have_tray, 'man-pages': scdoc.found(), }, bool_yn: true) diff --git a/meson_options.txt b/meson_options.txt index d3667acf..66c6d268 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,3 +6,4 @@ option('xwayland', type: 'feature', value: 'auto', description: 'Enable support option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray') option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybg') option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') +option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind'], value: 'auto', description: 'Provider of the sd-bus library') diff --git a/swaybar/meson.build b/swaybar/meson.build index 469145ae..9feb3cd2 100644 --- a/swaybar/meson.build +++ b/swaybar/meson.build @@ -19,11 +19,7 @@ swaybar_deps = [ wayland_cursor ] if have_tray - if systemd.found() - swaybar_deps += systemd - elif elogind.found() - swaybar_deps += elogind - endif + swaybar_deps += sdbus endif executable( |