mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
30 lines
561 B
C++
30 lines
561 B
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <fmt/format.h>
|
|
#include <sys/inotify.h>
|
|
#include <algorithm>
|
|
#include "util/chrono.hpp"
|
|
#include "ALabel.hpp"
|
|
|
|
namespace waybar::modules {
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
class Battery : public ALabel {
|
|
public:
|
|
Battery(Json::Value);
|
|
auto update() -> void;
|
|
private:
|
|
std::string getIcon(uint16_t percentage);
|
|
|
|
static inline const fs::path data_dir_ = "/sys/class/power_supply/";
|
|
|
|
util::SleeperThread thread_;
|
|
std::vector<fs::path> batteries_;
|
|
};
|
|
|
|
}
|