mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-13 22:52:30 +02:00
added support for battery state-based classes on the entire waybar
This commit is contained in:
@ -16,6 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "ALabel.hpp"
|
||||
#include "bar.hpp"
|
||||
#include "util/sleeper_thread.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
@ -28,7 +29,7 @@ namespace fs = std::filesystem;
|
||||
|
||||
class Battery : public ALabel {
|
||||
public:
|
||||
Battery(const std::string&, const Json::Value&);
|
||||
Battery(const std::string&, const waybar::Bar&, const Json::Value&);
|
||||
virtual ~Battery();
|
||||
auto update() -> void override;
|
||||
|
||||
@ -40,6 +41,7 @@ class Battery : public ALabel {
|
||||
const std::string getAdapterStatus(uint8_t capacity) const;
|
||||
const std::tuple<uint8_t, float, std::string, float> getInfos();
|
||||
const std::string formatTimeRemaining(float hoursRemaining);
|
||||
void setBarClass(std::string&);
|
||||
|
||||
int global_watch;
|
||||
std::map<fs::path, int> batteries_;
|
||||
@ -49,6 +51,7 @@ class Battery : public ALabel {
|
||||
std::mutex battery_list_mutex_;
|
||||
std::string old_status_;
|
||||
bool warnFirstTime_{true};
|
||||
const Bar& bar_;
|
||||
|
||||
util::SleeperThread thread_;
|
||||
util::SleeperThread thread_battery_update_;
|
||||
|
Reference in New Issue
Block a user