2019-02-17 14:27:54 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
2022-04-06 06:37:19 +00:00
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
#include "ALabel.hpp"
|
2019-02-17 14:27:54 +00:00
|
|
|
#include "bar.hpp"
|
|
|
|
#include "client.hpp"
|
|
|
|
|
|
|
|
namespace waybar::modules {
|
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
class IdleInhibitor : public ALabel {
|
2022-05-04 15:29:08 +00:00
|
|
|
sigc::connection timeout_;
|
2022-04-10 13:17:52 +00:00
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
public:
|
|
|
|
IdleInhibitor(const std::string&, const waybar::Bar&, const Json::Value&);
|
|
|
|
~IdleInhibitor();
|
|
|
|
auto update() -> void;
|
2020-11-01 18:25:41 +00:00
|
|
|
static std::list<waybar::AModule*> modules;
|
2022-04-06 06:37:19 +00:00
|
|
|
static bool status;
|
2019-04-18 15:52:00 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool handleToggle(GdkEventButton* const& e);
|
2022-10-14 01:47:57 +00:00
|
|
|
void toggleStatus();
|
2019-02-17 14:27:54 +00:00
|
|
|
|
2022-04-06 06:37:19 +00:00
|
|
|
const Bar& bar_;
|
2020-11-01 13:38:58 +00:00
|
|
|
struct zwp_idle_inhibitor_v1* idle_inhibitor_;
|
2022-04-06 06:37:19 +00:00
|
|
|
int pid_;
|
2019-02-17 14:27:54 +00:00
|
|
|
};
|
|
|
|
|
2019-04-18 15:52:00 +00:00
|
|
|
} // namespace waybar::modules
|