Rearranging code in a non-redundant way.
This commit is contained in:
@@ -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_);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user