Apply jbeich suggestion for if defined(__linux__)
parent
830c5cd5d0
commit
45e44e03bd
|
@ -6,7 +6,9 @@
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#endif
|
#endif
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#if #defined(__linux__)
|
||||||
#include <sys/inotify.h>
|
#include <sys/inotify.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
|
@ -31,7 +31,7 @@ waybar::modules::Battery::Battery(const std::string& id, const Json::Value& conf
|
||||||
}
|
}
|
||||||
|
|
||||||
waybar::modules::Battery::~Battery() {
|
waybar::modules::Battery::~Battery() {
|
||||||
#if (__Linux__)
|
#if defined(__linux__)
|
||||||
std::lock_guard<std::mutex> guard(battery_list_mutex_);
|
std::lock_guard<std::mutex> guard(battery_list_mutex_);
|
||||||
|
|
||||||
if (global_watch >= 0) {
|
if (global_watch >= 0) {
|
||||||
|
@ -87,7 +87,7 @@ void waybar::modules::Battery::worker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void waybar::modules::Battery::refreshBatteries() {
|
void waybar::modules::Battery::refreshBatteries() {
|
||||||
#if (__Linux__)
|
#if defined(__linux__)
|
||||||
std::lock_guard<std::mutex> guard(battery_list_mutex_);
|
std::lock_guard<std::mutex> guard(battery_list_mutex_);
|
||||||
// Mark existing list of batteries as not necessarily found
|
// Mark existing list of batteries as not necessarily found
|
||||||
std::map<fs::path, bool> check_map;
|
std::map<fs::path, bool> check_map;
|
||||||
|
@ -525,7 +525,7 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string waybar::modules::Battery::getAdapterStatus(uint8_t capacity) const {
|
const std::string waybar::modules::Battery::getAdapterStatus(uint8_t capacity) const {
|
||||||
#if defined(__Linux__)
|
#if defined(__linux__)
|
||||||
if (!adapter_.empty()) {
|
if (!adapter_.empty()) {
|
||||||
bool online;
|
bool online;
|
||||||
std::string status;
|
std::string status;
|
||||||
|
@ -546,7 +546,7 @@ const std::string waybar::modules::Battery::getAdapterStatus(uint8_t capacity) c
|
||||||
return "Plugged";
|
return "Plugged";
|
||||||
}
|
}
|
||||||
return "Discharging";
|
return "Discharging";
|
||||||
#if defined(__Linux__)
|
#if defined(__linux__)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
@ -570,7 +570,7 @@ const std::string waybar::modules::Battery::formatTimeRemaining(float hoursRemai
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Battery::update() -> void {
|
auto waybar::modules::Battery::update() -> void {
|
||||||
#if __Linux__
|
#if defined(__linux__)
|
||||||
if (batteries_.empty()) {
|
if (batteries_.empty()) {
|
||||||
event_box_.hide();
|
event_box_.hide();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue