diff --git a/include/modules/battery.hpp b/include/modules/battery.hpp index 5f25fd59..42cf1647 100644 --- a/include/modules/battery.hpp +++ b/include/modules/battery.hpp @@ -6,7 +6,9 @@ #include #endif #include +#if #defined(__linux__) #include +#endif #include #include diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 1fbdcb58..13a49208 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -31,7 +31,7 @@ waybar::modules::Battery::Battery(const std::string& id, const Json::Value& conf } waybar::modules::Battery::~Battery() { -#if (__Linux__) +#if defined(__linux__) std::lock_guard guard(battery_list_mutex_); if (global_watch >= 0) { @@ -87,7 +87,7 @@ void waybar::modules::Battery::worker() { } void waybar::modules::Battery::refreshBatteries() { -#if (__Linux__) +#if defined(__linux__) std::lock_guard guard(battery_list_mutex_); // Mark existing list of batteries as not necessarily found std::map check_map; @@ -525,7 +525,7 @@ const std::tuple waybar::modules::Battery::g } const std::string waybar::modules::Battery::getAdapterStatus(uint8_t capacity) const { -#if defined(__Linux__) +#if defined(__linux__) if (!adapter_.empty()) { bool online; std::string status; @@ -546,7 +546,7 @@ const std::string waybar::modules::Battery::getAdapterStatus(uint8_t capacity) c return "Plugged"; } return "Discharging"; -#if defined(__Linux__) +#if defined(__linux__) } #endif return "Unknown"; @@ -570,7 +570,7 @@ const std::string waybar::modules::Battery::formatTimeRemaining(float hoursRemai } auto waybar::modules::Battery::update() -> void { -#if __Linux__ +#if defined(__linux__) if (batteries_.empty()) { event_box_.hide(); return;