feat: args && class id

This commit is contained in:
Alexis
2018-12-18 17:30:54 +01:00
parent 66ad2864c2
commit b554094c7e
29 changed files with 1405 additions and 93 deletions

View File

@ -6,26 +6,26 @@
namespace waybar {
class ALabel : public IModule {
public:
ALabel(const Json::Value&, const std::string format, uint16_t interval = 0);
public:
ALabel(const Json::Value &, const std::string format, uint16_t interval = 0);
virtual ~ALabel() = default;
virtual auto update() -> void;
virtual std::string getIcon(uint16_t, const std::string& alt = "");
virtual operator Gtk::Widget&();
virtual std::string getIcon(uint16_t, const std::string &alt = "");
virtual operator Gtk::Widget &();
protected:
protected:
Gtk::EventBox event_box_;
Gtk::Label label_;
const Json::Value& config_;
const Json::Value &config_;
std::string format_;
std::mutex mutex_;
const std::chrono::seconds interval_;
private:
bool handleToggle(GdkEventButton* const& ev);
bool handleScroll(GdkEventScroll*);
private:
bool handleToggle(GdkEventButton *const &ev);
bool handleScroll(GdkEventScroll *);
bool alt = false;
const std::string default_format_;
};
} // namespace waybar
} // namespace waybar

View File

@ -15,7 +15,7 @@ class Client {
Client(int argc, char *argv[]);
int main(int argc, char *argv[]);
Glib::RefPtr<Gtk::Application> gtk_app;
Gtk::Main gtk_main;
std::string css_file;
std::string config_file;
Glib::RefPtr<Gdk::Display> gdk_display;
@ -27,8 +27,8 @@ class Client {
std::vector<std::unique_ptr<Bar>> bars;
private:
void setupConfigs(const std::string& config, const std::string& style);
void bindInterfaces();
auto setupCss();
const std::string getValidPath(std::vector<std::string> paths);
static void handleGlobal(void *data, struct wl_registry *registry,

View File

@ -23,7 +23,7 @@ namespace fs = std::filesystem;
class Battery : public ALabel {
public:
Battery(const Json::Value&);
Battery(const std::string&, const Json::Value&);
~Battery();
auto update() -> void;
private:

View File

@ -9,7 +9,7 @@ namespace waybar::modules {
class Clock : public ALabel {
public:
Clock(const Json::Value&);
Clock(const std::string&, const Json::Value&);
auto update() -> void;
private:
waybar::util::SleeperThread thread_;

View File

@ -13,7 +13,7 @@ namespace waybar::modules {
class Cpu : public ALabel {
public:
Cpu(const Json::Value&);
Cpu(const std::string&, const Json::Value&);
auto update() -> void;
private:
static inline const std::string data_dir_ = "/proc/stat";

View File

@ -11,7 +11,7 @@ namespace waybar::modules {
class Custom : public ALabel {
public:
Custom(const std::string, const Json::Value&);
Custom(const std::string&, const Json::Value&);
~Custom();
auto update() -> void;
private:

View File

@ -9,7 +9,7 @@ namespace waybar::modules {
class Memory : public ALabel {
public:
Memory(const Json::Value&);
Memory(const std::string&, const Json::Value&);
auto update() -> void;
private:
static inline const std::string data_dir_ = "/proc/meminfo";

View File

@ -15,7 +15,7 @@ namespace waybar::modules {
class Network : public ALabel {
public:
Network(const Json::Value&);
Network(const std::string&, const Json::Value&);
~Network();
auto update() -> void;
private:

View File

@ -10,7 +10,7 @@ namespace waybar::modules {
class Pulseaudio : public ALabel {
public:
Pulseaudio(const Json::Value&);
Pulseaudio(const std::string&, const Json::Value&);
~Pulseaudio();
auto update() -> void;
private:

View File

@ -12,7 +12,7 @@ namespace waybar::modules::SNI {
class Tray : public IModule {
public:
Tray(const Json::Value&);
Tray(const std::string&, const Json::Value&);
auto update() -> void;
operator Gtk::Widget &();
private:

View File

@ -12,7 +12,7 @@ namespace waybar::modules::sway {
class Mode : public ALabel {
public:
Mode(const waybar::Bar&, const Json::Value&);
Mode(const std::string&, const waybar::Bar&, const Json::Value&);
auto update() -> void;
private:
void worker();

View File

@ -13,7 +13,7 @@ namespace waybar::modules::sway {
class Window : public ALabel {
public:
Window(const waybar::Bar&, const Json::Value&);
Window(const std::string&, const waybar::Bar&, const Json::Value&);
auto update() -> void;
private:
void worker();

View File

@ -12,7 +12,7 @@ namespace waybar::modules::sway {
class Workspaces : public IModule {
public:
Workspaces(const waybar::Bar&, const Json::Value&);
Workspaces(const std::string&, const waybar::Bar&, const Json::Value&);
auto update() -> void;
operator Gtk::Widget &();
private:

View File

@ -63,14 +63,14 @@ struct SleeperThread {
{
do_run_ = false;
condvar_.notify_all();
if (thread_.joinable()) {
thread_.detach();
}
}
~SleeperThread()
{
stop();
if (thread_.joinable()) {
thread_.detach();
}
}
private:

1264
include/util/clara.hpp Normal file

File diff suppressed because it is too large Load Diff