Merge pull request #2247 from gardenappl/hypr-backend

More robust Hyprland backend
This commit is contained in:
Alexis Rouillard 2023-06-20 13:21:34 +02:00 committed by GitHub
commit 238cfa9547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -181,17 +181,21 @@ std::string IPC::getSocket1Reply(const std::string& rq) {
}
char buffer[8192] = {0};
std::string response;
sizeWritten = read(SERVERSOCKET, buffer, 8192);
do {
sizeWritten = read(SERVERSOCKET, buffer, 8192);
if (sizeWritten < 0) {
spdlog::error("Hyprland IPC: Couldn't read (5)");
return "";
}
if (sizeWritten < 0) {
spdlog::error("Hyprland IPC: Couldn't read (5)");
close(SERVERSOCKET);
return "";
}
response.append(buffer, sizeWritten);
} while (sizeWritten == 8192);
close(SERVERSOCKET);
return std::string(buffer);
return response;
}
} // namespace waybar::modules::hyprland