From 496e7825441cba05939090de4a9bc94d6292b02c Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 9 Aug 2019 09:52:16 +0000 Subject: [PATCH] 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 ^~~~~~~~~~~~~~~ --- include/factory.hpp | 2 +- meson.build | 7 ++++++- src/factory.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/factory.hpp b/include/factory.hpp index b14b9988..a337335b 100644 --- a/include/factory.hpp +++ b/include/factory.hpp @@ -7,7 +7,7 @@ #include "modules/sway/window.hpp" #include "modules/sway/workspaces.hpp" #endif -#ifndef NO_FILESYSTEM +#if defined(__linux__) && !defined(NO_FILESYSTEM) #include "modules/battery.hpp" #endif #include "modules/cpu.hpp" diff --git a/meson.build b/meson.build index a8b91dc3..d1528c44 100644 --- a/meson.build +++ b/meson.build @@ -114,7 +114,6 @@ src_files = files( 'src/AModule.cpp', 'src/ALabel.cpp', 'src/modules/memory.cpp', - 'src/modules/battery.cpp', 'src/modules/bluetooth.cpp', 'src/modules/clock.cpp', 'src/modules/custom.cpp', @@ -128,6 +127,12 @@ src_files = files( 'src/util/rfkill.cpp' ) +if is_linux + src_files += files( + 'src/modules/battery.cpp', + ) +endif + if true # find_program('sway', required : false).found() add_project_arguments('-DHAVE_SWAY', language: 'cpp') src_files += [ diff --git a/src/factory.cpp b/src/factory.cpp index 16a6903a..73c9f9f7 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -7,7 +7,7 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const { auto hash_pos = name.find('#'); auto ref = name.substr(0, hash_pos); auto id = hash_pos != std::string::npos ? name.substr(hash_pos + 1) : ""; -#ifndef NO_FILESYSTEM +#if defined(__linux__) && !defined(NO_FILESYSTEM) if (ref == "battery") { return new waybar::modules::Battery(id, config_[name]); }