From facb53e81f5f097e6c104f8efd092d461c458694 Mon Sep 17 00:00:00 2001 From: may Date: Sun, 16 Jul 2023 04:14:43 +0200 Subject: [PATCH 1/2] backlight: do not convert percent to string in fmt --- src/modules/backlight.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/backlight.cpp b/src/modules/backlight.cpp index 58d14dde..a595073e 100644 --- a/src/modules/backlight.cpp +++ b/src/modules/backlight.cpp @@ -191,7 +191,7 @@ auto waybar::modules::Backlight::update() -> void { const uint8_t percent = best->get_max() == 0 ? 100 : round(best->get_actual() * 100.0f / best->get_max()); std::string desc = - fmt::format(fmt::runtime(format_), fmt::arg("percent", std::to_string(percent)), + fmt::format(fmt::runtime(format_), fmt::arg("percent", percent), fmt::arg("icon", getIcon(percent))); label_.set_markup(desc); getState(percent); @@ -202,7 +202,7 @@ auto waybar::modules::Backlight::update() -> void { } if (!tooltip_format.empty()) { label_.set_tooltip_text(fmt::format(fmt::runtime(tooltip_format), - fmt::arg("percent", std::to_string(percent)), + fmt::arg("percent", percent), fmt::arg("icon", getIcon(percent)))); } else { label_.set_tooltip_text(desc); From 0f6eff1f206276ca7a0cbaa8eb40103f8e4b5c8b Mon Sep 17 00:00:00 2001 From: Calvin Chu Date: Sun, 16 Jul 2023 21:58:15 +1000 Subject: [PATCH 2/2] hyprland: fix json parser runtime err from socket read ending early --- src/modules/hyprland/backend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/hyprland/backend.cpp b/src/modules/hyprland/backend.cpp index 79bc6375..6e586966 100644 --- a/src/modules/hyprland/backend.cpp +++ b/src/modules/hyprland/backend.cpp @@ -192,7 +192,7 @@ std::string IPC::getSocket1Reply(const std::string& rq) { return ""; } response.append(buffer, sizeWritten); - } while (sizeWritten == 8192); + } while (sizeWritten > 0); close(SERVERSOCKET); return response;