mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: execute update on idle
This commit is contained in:
13
src/bar.cpp
13
src/bar.cpp
@ -272,11 +272,14 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos) {
|
||||
modules_right_.emplace_back(module);
|
||||
}
|
||||
module->dp.connect([module, &name] {
|
||||
try {
|
||||
module->update();
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << name.asString() + ": " + e.what() << std::endl;
|
||||
}
|
||||
// Fix https://github.com/Alexays/Waybar/issues/320, proper way?
|
||||
Glib::signal_idle().connect_once([module, &name] {
|
||||
try {
|
||||
module->update();
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << name.asString() + ": " + e.what() << std::endl;
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
|
Reference in New Issue
Block a user