waybar/include/modules/idle_inhibitor.hpp

31 lines
623 B
C++
Raw Permalink Normal View History

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