mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(workspaces): check thread is running
This commit is contained in:
@ -69,8 +69,7 @@ struct waybar::modules::sway::Ipc::ipc_response
|
||||
size_t total = 0;
|
||||
|
||||
while (total < ipc_header_size_) {
|
||||
ssize_t res =
|
||||
::recv(fd, header.data() + total, ipc_header_size_ - total, 0);
|
||||
auto res = ::recv(fd, header.data() + total, ipc_header_size_ - total, 0);
|
||||
if (res <= 0) {
|
||||
throw std::runtime_error("Unable to receive IPC response");
|
||||
}
|
||||
@ -81,8 +80,7 @@ struct waybar::modules::sway::Ipc::ipc_response
|
||||
std::string payload;
|
||||
payload.reserve(data32[0] + 1);
|
||||
while (total < data32[0]) {
|
||||
ssize_t res =
|
||||
::recv(fd, payload.data() + total, data32[0] - total, 0);
|
||||
auto res = ::recv(fd, payload.data() + total, data32[0] - total, 0);
|
||||
if (res < 0) {
|
||||
throw std::runtime_error("Unable to receive IPC response");
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ void waybar::modules::sway::Mode::worker()
|
||||
dp.emit();
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::cerr << "Mode: " << e.what() << std::endl;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void waybar::modules::sway::Window::worker()
|
||||
dp.emit();
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::cerr << "Window: " << e.what() << std::endl;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void waybar::modules::sway::Workspaces::worker()
|
||||
while (bar_.output_name.empty()) {
|
||||
thread_.sleep_for(chrono::milliseconds(150));
|
||||
}
|
||||
} else if (!workspaces_.empty()) {
|
||||
} else if (thread_.isRunnging() && !workspaces_.empty()) {
|
||||
ipc_.handleEvent();
|
||||
}
|
||||
{
|
||||
@ -30,7 +30,7 @@ void waybar::modules::sway::Workspaces::worker()
|
||||
}
|
||||
dp.emit();
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
std::cerr << "Workspaces: " << e.what() << std::endl;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user