mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat(battery): check adapter online as fallback when battery status report unknown
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
#include <fmt/format.h>
|
||||
#include <sys/inotify.h>
|
||||
#include <algorithm>
|
||||
#include "util/chrono.hpp"
|
||||
#include "util/sleeper_thread.hpp"
|
||||
#include "ALabel.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
@ -28,15 +28,19 @@ class Battery : public ALabel {
|
||||
auto update() -> void;
|
||||
private:
|
||||
static inline const fs::path data_dir_ = "/sys/class/power_supply/";
|
||||
|
||||
|
||||
void getBatteries();
|
||||
void worker();
|
||||
const std::string getAdapterStatus(uint8_t capacity) const;
|
||||
const std::tuple<uint8_t, std::string> getInfos() const;
|
||||
const std::string getState(uint8_t) const;
|
||||
|
||||
util::SleeperThread thread_;
|
||||
util::SleeperThread thread_timer_;
|
||||
std::vector<fs::path> batteries_;
|
||||
fs::path adapter_;
|
||||
int fd_;
|
||||
std::vector<int> wds_;
|
||||
std::string old_status_;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user