feat(custom): update on click/scroll

This commit is contained in:
Alex 2019-05-18 16:07:55 +02:00
parent d5e8a37e63
commit ff28de0482
2 changed files with 14 additions and 0 deletions

View File

@ -22,6 +22,8 @@ class Custom : public ALabel {
void continuousWorker(); void continuousWorker();
void parseOutputRaw(); void parseOutputRaw();
void parseOutputJson(); void parseOutputJson();
bool handleScroll(GdkEventScroll* e);
bool handleToggle(GdkEventButton* const& e);
const std::string name_; const std::string name_;
std::string text_; std::string text_;

View File

@ -79,6 +79,18 @@ void waybar::modules::Custom::refresh(int sig /*signal*/) {
} }
} }
bool waybar::modules::Custom::handleScroll(GdkEventScroll* e) {
auto ret = ALabel::handleScroll(e);
thread_.wake_up();
return ret;
}
bool waybar::modules::Custom::handleToggle(GdkEventButton* const& e) {
auto ret = ALabel::handleToggle(e);
thread_.wake_up();
return ret;
}
auto waybar::modules::Custom::update() -> void { auto waybar::modules::Custom::update() -> void {
// Hide label if output is empty // Hide label if output is empty
if (config_["exec"].isString() && (output_.out.empty() || output_.exit_code != 0)) { if (config_["exec"].isString() && (output_.out.empty() || output_.exit_code != 0)) {