fix: Fix hide_on_ok when user or system session is ignored

In case of an user ignoring the failed system or user units, hiding of
the waybar module did not work.

Ensure that the ignore case of a system or user bus is reflected
correctly by determining the configuration.

Fixes [1] where regression was introduced in [2].

Links:
[1] https://github.com/Alexays/Waybar/issues/4241
[2] https://github.com/Alexays/Waybar/issues/4240

Signed-off-by: Steffen Kothe <steffen.kothe@skothe.net>
This commit is contained in:
Steffen Kothe
2025-08-15 10:58:27 +00:00
parent 4a7da0cab2
commit 3060141a65
+4 -2
View File
@@ -74,7 +74,7 @@ auto SystemdFailedUnits::notify_cb(const Glib::ustring& sender_name,
void SystemdFailedUnits::RequestSystemState() {
auto load = [](const char* kind, Glib::RefPtr<Gio::DBus::Proxy>& proxy) -> std::string {
try {
if (!proxy) return "unknown";
if (!proxy) return "ignored";
auto parameters = Glib::VariantContainerBase(
g_variant_new("(ss)", "org.freedesktop.systemd1.Manager", "SystemState"));
Glib::VariantContainerBase data = proxy->call_sync("Get", parameters);
@@ -93,7 +93,9 @@ void SystemdFailedUnits::RequestSystemState() {
system_state = load("systemwide", system_proxy);
user_state = load("user", user_proxy);
if (system_state == "running" && user_state == "running")
if ((system_state == "running" || system_state == "ignored") &&
(user_state == "running" || user_state == "ignored"))
overall_state = "ok";
else
overall_state = "degraded";