diff --git a/meson.build b/meson.build index 41d4624b..7182999b 100644 --- a/meson.build +++ b/meson.build @@ -32,7 +32,7 @@ wayland_cursor = dependency('wayland-cursor') wayland_protos = dependency('wayland-protocols') wlroots = dependency('wlroots', fallback: ['wlroots', 'wlroots']) gtkmm = dependency('gtkmm-3.0') -dbusmenu_gtk = dependency('dbusmenu-gtk3-0.4') +dbusmenu_gtk = dependency('dbusmenu-gtk3-0.4', required: get_option('dbusmenu-gtk')) jsoncpp = dependency('jsoncpp') sigcpp = dependency('sigc++-2.0') libnl = dependency('libnl-3.0', required: get_option('libnl')) @@ -47,10 +47,6 @@ src_files = files( 'src/modules/clock.cpp', 'src/modules/custom.cpp', 'src/modules/cpu.cpp', - 'src/modules/sni/tray.cpp', - 'src/modules/sni/snw.cpp', - 'src/modules/sni/snh.cpp', - 'src/modules/sni/sni.cpp', 'src/main.cpp', 'src/bar.cpp', 'src/client.cpp' @@ -75,6 +71,16 @@ if libpulse.found() src_files += 'src/modules/pulseaudio.cpp' endif +if dbusmenu_gtk.found() + add_project_arguments('-DHAVE_DBUSMENU', language: 'cpp') + src_files += files( + 'src/modules/sni/tray.cpp', + 'src/modules/sni/snw.cpp', + 'src/modules/sni/snh.cpp', + 'src/modules/sni/sni.cpp' + ) +endif + subdir('protocol') executable( diff --git a/meson_options.txt b/meson_options.txt index 2d493112..754dcab5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,3 @@ option('libnl', type: 'feature', value: 'auto', description: 'Enable libnl support for network related features') option('pulseaudio', type: 'feature', value: 'auto', description: 'Enable support for pulseaudio') +option('dbusmenu-gtk', type: 'feature', value: 'auto', description: 'Enable support for tray') \ No newline at end of file diff --git a/src/factory.cpp b/src/factory.cpp index d3c53f39..77302dd1 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -27,9 +27,11 @@ waybar::IModule* waybar::Factory::makeModule(const std::string &name) const if (name == "clock") { return new waybar::modules::Clock(config_[name]); } + #ifdef DHAVE_DBUSMENU if (name == "tray") { return new waybar::modules::SNI::Tray(config_[name]); } + #endif #ifdef HAVE_LIBNL if (name == "network") { return new waybar::modules::Network(config_[name]);