feat(ALabel): Toggleable labels

This commit is contained in:
Alexis
2018-08-27 01:36:25 +02:00
parent e9478f548e
commit 53956d9d18
13 changed files with 75 additions and 63 deletions

View File

@ -7,13 +7,20 @@ namespace waybar {
class ALabel : public IModule {
public:
ALabel(const Json::Value&);
ALabel(const Json::Value&, const std::string format);
virtual ~ALabel() = default;
virtual auto update() -> void;
virtual std::string getIcon(uint16_t percentage);
virtual operator Gtk::Widget &();
protected:
Gtk::EventBox event_box_;
Gtk::Label label_;
const Json::Value& config_;
std::string format_;
private:
bool handleToggle(GdkEventButton* const& ev);
bool alt = false;
const std::string default_format_;
};
}

View File

@ -22,7 +22,6 @@ class Battery : public ALabel {
static inline const fs::path data_dir_ = "/sys/class/power_supply/";
void worker();
std::string getIcon(uint16_t percentage);
util::SleeperThread thread_;
std::vector<fs::path> batteries_;

View File

@ -19,8 +19,6 @@ class Pulseaudio : public ALabel {
static void sinkInfoCb(pa_context*, const pa_sink_info*, int, void*);
static void serverInfoCb(pa_context*, const pa_server_info*, void*);
std::string getIcon(uint16_t);
pa_threaded_mainloop* mainloop_;
pa_mainloop_api* mainloop_api_;
pa_context* context_;