mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
chore: optional deps
This commit is contained in:
parent
49232eed8d
commit
8be67d5008
@ -2,13 +2,19 @@
|
|||||||
|
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
#include "modules/clock.hpp"
|
#include "modules/clock.hpp"
|
||||||
|
#ifdef HAVE_SWAY
|
||||||
#include "modules/sway/workspaces.hpp"
|
#include "modules/sway/workspaces.hpp"
|
||||||
#include "modules/sway/window.hpp"
|
#include "modules/sway/window.hpp"
|
||||||
|
#endif
|
||||||
#include "modules/battery.hpp"
|
#include "modules/battery.hpp"
|
||||||
#include "modules/memory.hpp"
|
#include "modules/memory.hpp"
|
||||||
#include "modules/cpu.hpp"
|
#include "modules/cpu.hpp"
|
||||||
|
#ifdef HAVE_LIBNL
|
||||||
#include "modules/network.hpp"
|
#include "modules/network.hpp"
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBPULSE
|
||||||
#include "modules/pulseaudio.hpp"
|
#include "modules/pulseaudio.hpp"
|
||||||
|
#endif
|
||||||
#include "modules/custom.hpp"
|
#include "modules/custom.hpp"
|
||||||
|
|
||||||
namespace waybar {
|
namespace waybar {
|
||||||
|
40
meson.build
40
meson.build
@ -31,14 +31,44 @@ wlroots = dependency('wlroots', fallback: ['wlroots', 'wlroots'])
|
|||||||
gtkmm = dependency('gtkmm-3.0')
|
gtkmm = dependency('gtkmm-3.0')
|
||||||
jsoncpp = dependency('jsoncpp')
|
jsoncpp = dependency('jsoncpp')
|
||||||
sigcpp = dependency('sigc++-2.0')
|
sigcpp = dependency('sigc++-2.0')
|
||||||
libnl = dependency('libnl-3.0')
|
libnl = dependency('libnl-3.0', required: false)
|
||||||
libnlgen = dependency('libnl-genl-3.0')
|
libnlgen = dependency('libnl-genl-3.0', required: false)
|
||||||
libpulse = dependency('libpulse')
|
libpulse = dependency('libpulse', required: false)
|
||||||
|
|
||||||
|
src_files = files(
|
||||||
|
'src/factory.cpp',
|
||||||
|
'src/ALabel.cpp',
|
||||||
|
'src/modules/memory.cpp',
|
||||||
|
'src/modules/battery.cpp',
|
||||||
|
'src/modules/clock.cpp',
|
||||||
|
'src/modules/custom.cpp',
|
||||||
|
'src/modules/cpu.cpp',
|
||||||
|
'src/main.cpp',
|
||||||
|
'src/bar.cpp',
|
||||||
|
'src/client.cpp'
|
||||||
|
)
|
||||||
|
|
||||||
|
if find_program('sway').found()
|
||||||
|
add_project_arguments('-DHAVE_SWAY', language: 'cpp')
|
||||||
|
src_files += [
|
||||||
|
'src/modules/sway/ipc/client.cpp',
|
||||||
|
'src/modules/sway/window.cpp',
|
||||||
|
'src/modules/sway/workspaces.cpp'
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if libnl.found() and libnlgen.found()
|
||||||
|
add_project_arguments('-DHAVE_LIBNL', language: 'cpp')
|
||||||
|
src_files += 'src/modules/network.cpp'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if libpulse.found()
|
||||||
|
add_project_arguments('-DHAVE_LIBPULSE', language: 'cpp')
|
||||||
|
src_files += 'src/modules/pulseaudio.cpp'
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('protocol')
|
subdir('protocol')
|
||||||
|
|
||||||
src_files = run_command('find', './src', '-name', '*.cpp').stdout().strip().split('\n')
|
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
'waybar',
|
'waybar',
|
||||||
src_files,
|
src_files,
|
||||||
|
@ -10,9 +10,11 @@ waybar::IModule* waybar::Factory::makeModule(const std::string &name) const
|
|||||||
if (name == "battery") {
|
if (name == "battery") {
|
||||||
return new waybar::modules::Battery(config_[name]);
|
return new waybar::modules::Battery(config_[name]);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SWAY
|
||||||
if (name == "sway/workspaces") {
|
if (name == "sway/workspaces") {
|
||||||
return new waybar::modules::sway::Workspaces(bar_, config_[name]);
|
return new waybar::modules::sway::Workspaces(bar_, config_[name]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (name == "sway/window") {
|
if (name == "sway/window") {
|
||||||
return new waybar::modules::sway::Window(bar_, config_[name]);
|
return new waybar::modules::sway::Window(bar_, config_[name]);
|
||||||
}
|
}
|
||||||
@ -25,12 +27,16 @@ waybar::IModule* waybar::Factory::makeModule(const std::string &name) const
|
|||||||
if (name == "clock") {
|
if (name == "clock") {
|
||||||
return new waybar::modules::Clock(config_[name]);
|
return new waybar::modules::Clock(config_[name]);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_LIBNL
|
||||||
if (name == "network") {
|
if (name == "network") {
|
||||||
return new waybar::modules::Network(config_[name]);
|
return new waybar::modules::Network(config_[name]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LIBPULSE
|
||||||
if (name == "pulseaudio") {
|
if (name == "pulseaudio") {
|
||||||
return new waybar::modules::Pulseaudio(config_[name]);
|
return new waybar::modules::Pulseaudio(config_[name]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (name.compare(0, 7, "custom/") == 0 && name.size() > 7) {
|
if (name.compare(0, 7, "custom/") == 0 && name.size() > 7) {
|
||||||
return new waybar::modules::Custom(name.substr(7), config_[name]);
|
return new waybar::modules::Custom(name.substr(7), config_[name]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user