battery: limit to Linux due to /sys/class/power_supply

../include/modules/battery.hpp:9:10: fatal error: 'sys/inotify.h' file not found
 #include <sys/inotify.h>
          ^~~~~~~~~~~~~~~
This commit is contained in:
Jan Beich 2019-08-09 09:52:16 +00:00
parent cfd7577e1b
commit 496e782544
3 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,7 @@
#include "modules/sway/window.hpp" #include "modules/sway/window.hpp"
#include "modules/sway/workspaces.hpp" #include "modules/sway/workspaces.hpp"
#endif #endif
#ifndef NO_FILESYSTEM #if defined(__linux__) && !defined(NO_FILESYSTEM)
#include "modules/battery.hpp" #include "modules/battery.hpp"
#endif #endif
#include "modules/cpu.hpp" #include "modules/cpu.hpp"

View File

@ -114,7 +114,6 @@ src_files = files(
'src/AModule.cpp', 'src/AModule.cpp',
'src/ALabel.cpp', 'src/ALabel.cpp',
'src/modules/memory.cpp', 'src/modules/memory.cpp',
'src/modules/battery.cpp',
'src/modules/bluetooth.cpp', 'src/modules/bluetooth.cpp',
'src/modules/clock.cpp', 'src/modules/clock.cpp',
'src/modules/custom.cpp', 'src/modules/custom.cpp',
@ -128,6 +127,12 @@ src_files = files(
'src/util/rfkill.cpp' 'src/util/rfkill.cpp'
) )
if is_linux
src_files += files(
'src/modules/battery.cpp',
)
endif
if true # find_program('sway', required : false).found() if true # find_program('sway', required : false).found()
add_project_arguments('-DHAVE_SWAY', language: 'cpp') add_project_arguments('-DHAVE_SWAY', language: 'cpp')
src_files += [ src_files += [

View File

@ -7,7 +7,7 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const {
auto hash_pos = name.find('#'); auto hash_pos = name.find('#');
auto ref = name.substr(0, hash_pos); auto ref = name.substr(0, hash_pos);
auto id = hash_pos != std::string::npos ? name.substr(hash_pos + 1) : ""; auto id = hash_pos != std::string::npos ? name.substr(hash_pos + 1) : "";
#ifndef NO_FILESYSTEM #if defined(__linux__) && !defined(NO_FILESYSTEM)
if (ref == "battery") { if (ref == "battery") {
return new waybar::modules::Battery(id, config_[name]); return new waybar::modules::Battery(id, config_[name]);
} }