bluetooth: limit to Linux due to missing /dev/rfkill

../src/modules/bluetooth.cpp:3:10: fatal error: 'linux/rfkill.h' file not found
 #include <linux/rfkill.h>
          ^~~~~~~~~~~~~~~~
This commit is contained in:
Jan Beich 2019-08-09 09:52:16 +00:00
parent 71b7b4e0f4
commit 1885ecc958
3 changed files with 6 additions and 2 deletions

View File

@ -36,7 +36,9 @@
#include "bar.hpp"
#include "modules/custom.hpp"
#include "modules/temperature.hpp"
#if defined(__linux__)
#include "modules/bluetooth.hpp"
#endif
namespace waybar {

View File

@ -117,7 +117,6 @@ src_files = files(
'src/factory.cpp',
'src/AModule.cpp',
'src/ALabel.cpp',
'src/modules/bluetooth.cpp',
'src/modules/clock.cpp',
'src/modules/custom.cpp',
'src/modules/disk.cpp',
@ -126,7 +125,6 @@ src_files = files(
'src/main.cpp',
'src/bar.cpp',
'src/client.cpp',
'src/util/rfkill.cpp'
)
if is_linux
@ -134,10 +132,12 @@ if is_linux
add_project_arguments('-DHAVE_MEMORY_LINUX', language: 'cpp')
src_files += files(
'src/modules/battery.cpp',
'src/modules/bluetooth.cpp',
'src/modules/cpu/common.cpp',
'src/modules/cpu/linux.cpp',
'src/modules/memory/common.cpp',
'src/modules/memory/linux.cpp',
'src/util/rfkill.cpp'
)
elif is_dragonfly or is_freebsd or is_netbsd or is_openbsd
add_project_arguments('-DHAVE_CPU_BSD', language: 'cpp')

View File

@ -70,9 +70,11 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const {
if (ref == "temperature") {
return new waybar::modules::Temperature(id, config_[name]);
}
#if defined(__linux__)
if (ref == "bluetooth") {
return new waybar::modules::Bluetooth(id, config_[name]);
}
#endif
if (ref.compare(0, 7, "custom/") == 0 && ref.size() > 7) {
return new waybar::modules::Custom(ref.substr(7), id, config_[name]);
}