feat: optional tray

This commit is contained in:
Alexis 2018-10-25 11:47:03 +02:00
parent f3975e6634
commit d4b97d5d09
3 changed files with 14 additions and 5 deletions

View File

@ -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(

View File

@ -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')

View File

@ -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]);