fix(gtk): use idle to avoid mutex

This commit is contained in:
Alexis
2018-08-10 23:21:21 +02:00
parent 95f1ab471a
commit 2512d51564
15 changed files with 42 additions and 71 deletions

View File

@ -8,9 +8,11 @@ waybar::modules::Custom::Custom(std::string name, Json::Value config)
std::cerr << name + " has no exec path." << std::endl;
return;
}
_thread = [this] {
update();
int interval = _config["interval"] ? _config["inveral"].asInt() : 30;
int interval = _config["interval"] ? _config["inveral"].asInt() : 30;
_thread = [this, interval] {
Glib::signal_idle().connect_once([this] {
update();
});
_thread.sleep_for(chrono::seconds(interval));
};
};