mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Fix MPD, add missing while loop
This commit is contained in:
parent
4d6e20a96d
commit
a446cd692d
@ -63,20 +63,22 @@ auto waybar::modules::MPD::update() -> void {
|
|||||||
|
|
||||||
std::thread waybar::modules::MPD::event_listener() {
|
std::thread waybar::modules::MPD::event_listener() {
|
||||||
return std::thread([this] {
|
return std::thread([this] {
|
||||||
try {
|
while (true) {
|
||||||
if (connection_ == nullptr) {
|
try {
|
||||||
// Retry periodically if no connection
|
if (connection_ == nullptr) {
|
||||||
dp.emit();
|
// Retry periodically if no connection
|
||||||
std::this_thread::sleep_for(interval_);
|
dp.emit();
|
||||||
} else {
|
std::this_thread::sleep_for(interval_);
|
||||||
waitForEvent();
|
} else {
|
||||||
dp.emit();
|
waitForEvent();
|
||||||
}
|
dp.emit();
|
||||||
} catch (const std::exception& e) {
|
}
|
||||||
if (strcmp(e.what(), "Connection to MPD closed") == 0) {
|
} catch (const std::exception& e) {
|
||||||
spdlog::debug("{}: {}", module_name_, e.what());
|
if (strcmp(e.what(), "Connection to MPD closed") == 0) {
|
||||||
} else {
|
spdlog::debug("{}: {}", module_name_, e.what());
|
||||||
spdlog::warn("{}: {}", module_name_, e.what());
|
} else {
|
||||||
|
spdlog::warn("{}: {}", module_name_, e.what());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user