Rearranging code in a non-redundant way.

This commit is contained in:
martuscellifaria
2026-06-12 09:48:44 +02:00
parent 4ef828f712
commit eb3669decc
+5 -5
View File
@@ -39,12 +39,16 @@ waybar::modules::Custom::~Custom() {
} }
void waybar::modules::Custom::delayWorker() { void waybar::modules::Custom::delayWorker() {
if (!config_["exec"].isString() && !config_["exec-if"].isString()) {
dp.emit();
return;
}
thread_ = [this] { thread_ = [this] {
for (int i : this->pid_children_) { for (int i : this->pid_children_) {
int status; int status;
waitpid(i, &status, 0); waitpid(i, &status, 0);
} }
this->pid_children_.clear(); this->pid_children_.clear();
bool can_update = true; bool can_update = true;
@@ -61,10 +65,6 @@ void waybar::modules::Custom::delayWorker() {
} }
dp.emit(); dp.emit();
} }
if (!config_["exec"].isString() && !config_["exec-if"].isString()) {
thread_.stop();
return;
}
thread_.sleep_for(interval_); thread_.sleep_for(interval_);
}; };
} }