mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat(modules): generic label module to allow max-length on all labels
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <json/json.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
@ -8,24 +7,21 @@
|
||||
#include <sys/inotify.h>
|
||||
#include <algorithm>
|
||||
#include "util/chrono.hpp"
|
||||
#include "IModule.hpp"
|
||||
#include "ALabel.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
class Battery : public IModule {
|
||||
class Battery : public ALabel {
|
||||
public:
|
||||
Battery(Json::Value);
|
||||
auto update() -> void;
|
||||
operator Gtk::Widget&();
|
||||
private:
|
||||
std::string getIcon(uint16_t percentage);
|
||||
|
||||
static inline const fs::path data_dir_ = "/sys/class/power_supply/";
|
||||
|
||||
Gtk::Label label_;
|
||||
Json::Value config_;
|
||||
util::SleeperThread thread_;
|
||||
std::vector<fs::path> batteries_;
|
||||
};
|
||||
|
Reference in New Issue
Block a user