mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Don't update battery list on every update
Speedup battery state update by only updating the battery list when we get a CREATE/DELETE event in the directory or whenever we do a full refresh on the interval.
This commit is contained in:
@ -34,16 +34,19 @@ class Battery : public ALabel {
|
||||
void refreshBatteries();
|
||||
void worker();
|
||||
const std::string getAdapterStatus(uint8_t capacity) const;
|
||||
const std::tuple<uint8_t, float, std::string> getInfos() const;
|
||||
const std::tuple<uint8_t, float, std::string> getInfos();
|
||||
const std::string formatTimeRemaining(float hoursRemaining);
|
||||
|
||||
int global_watch;
|
||||
std::map<fs::path,int> batteries_;
|
||||
fs::path adapter_;
|
||||
int fd_;
|
||||
int battery_watch_fd_;
|
||||
int global_watch_fd_;
|
||||
std::mutex battery_list_mutex_;
|
||||
std::string old_status_;
|
||||
|
||||
util::SleeperThread thread_;
|
||||
util::SleeperThread thread_battery_update_;
|
||||
util::SleeperThread thread_timer_;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user