2021-12-03 22:32:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <gio/gio.h>
|
|
|
|
|
2022-04-06 06:37:19 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2022-11-24 11:28:52 +00:00
|
|
|
#include "ALabel.hpp"
|
2021-12-03 22:32:53 +00:00
|
|
|
#include "bar.hpp"
|
|
|
|
|
|
|
|
namespace waybar::modules {
|
|
|
|
|
2022-11-24 11:28:52 +00:00
|
|
|
class Inhibitor : public ALabel {
|
2021-12-03 22:32:53 +00:00
|
|
|
public:
|
|
|
|
Inhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
|
2023-03-02 13:57:07 +00:00
|
|
|
virtual ~Inhibitor();
|
|
|
|
auto update() -> void override;
|
2021-12-03 22:32:53 +00:00
|
|
|
auto activated() -> bool;
|
|
|
|
|
|
|
|
private:
|
2023-03-02 13:57:07 +00:00
|
|
|
auto handleToggle(::GdkEventButton* const& e) -> bool override;
|
2021-12-03 22:32:53 +00:00
|
|
|
|
2022-04-06 06:37:19 +00:00
|
|
|
const std::unique_ptr<::GDBusConnection, void (*)(::GDBusConnection*)> dbus_;
|
2021-12-03 22:32:53 +00:00
|
|
|
const std::string inhibitors_;
|
|
|
|
int handle_ = -1;
|
|
|
|
};
|
|
|
|
|
2022-04-06 06:37:19 +00:00
|
|
|
} // namespace waybar::modules
|