Files

55 lines
1.6 KiB
C++
Raw Permalink Normal View History

2024-01-09 18:05:17 +08:00
#pragma once
#include <giomm/dbusproxy.h>
2024-01-30 09:07:37 +01:00
#include <string>
#include <vector>
2024-01-30 09:07:37 +01:00
2024-01-09 18:05:17 +08:00
#include "ALabel.hpp"
namespace waybar::modules {
class SystemdFailedUnits : public ALabel {
public:
2026-02-04 09:24:14 +01:00
SystemdFailedUnits(const std::string&, const Json::Value&);
2026-03-17 21:33:21 +00:00
virtual ~SystemdFailedUnits() = default;
2024-01-09 18:05:17 +08:00
auto update() -> void override;
private:
struct FailedUnit {
std::string name;
std::string description;
std::string load_state;
std::string active_state;
std::string sub_state;
std::string scope;
};
2026-03-17 21:33:21 +00:00
bool hide_on_ok_;
std::string format_ok_;
std::string tooltip_format_;
std::string tooltip_format_ok_;
std::string tooltip_unit_format_;
2024-01-09 18:05:17 +08:00
2026-03-17 21:33:21 +00:00
bool update_pending_;
std::string system_state_, user_state_, overall_state_;
uint32_t nr_failed_system_, nr_failed_user_, nr_failed_;
std::string last_status_;
Glib::RefPtr<Gio::DBus::Proxy> system_props_proxy_, user_props_proxy_;
Glib::RefPtr<Gio::DBus::Proxy> system_manager_proxy_, user_manager_proxy_;
std::vector<FailedUnit> failed_units_;
2024-01-09 18:05:17 +08:00
2026-02-04 09:24:14 +01:00
void notify_cb(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
const Glib::VariantContainerBase& arguments);
void RequestFailedUnits();
void RequestFailedUnitsList();
void RequestSystemState();
std::vector<FailedUnit> LoadFailedUnitsList(const char* kind,
Glib::RefPtr<Gio::DBus::Proxy>& proxy,
const std::string& scope);
std::string BuildTooltipFailedList() const;
2024-01-09 18:05:17 +08:00
void updateData();
};
} // namespace waybar::modules