2020-01-21 17:04:54 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-03 04:17:06 +01:00
|
|
|
#include <glibmm/iochannel.h>
|
2020-01-21 17:04:54 +01:00
|
|
|
#include <linux/rfkill.h>
|
2021-02-03 04:17:06 +01:00
|
|
|
#include <sigc++/signal.h>
|
|
|
|
#include <sigc++/trackable.h>
|
2020-01-21 17:04:54 +01:00
|
|
|
|
2020-01-23 17:17:29 +01:00
|
|
|
namespace waybar::util {
|
2020-01-21 17:04:54 +01:00
|
|
|
|
2021-02-03 04:17:06 +01:00
|
|
|
class Rfkill : public sigc::trackable {
|
2020-05-27 09:10:38 +02:00
|
|
|
public:
|
2020-01-23 17:17:29 +01:00
|
|
|
Rfkill(enum rfkill_type rfkill_type);
|
2021-02-03 04:17:06 +01:00
|
|
|
~Rfkill();
|
2020-02-23 23:09:05 +01:00
|
|
|
bool getState() const;
|
2020-01-23 17:17:29 +01:00
|
|
|
|
2021-02-03 04:17:06 +01:00
|
|
|
sigc::signal<void(struct rfkill_event&)> on_update;
|
|
|
|
|
2020-01-23 17:17:29 +01:00
|
|
|
private:
|
|
|
|
enum rfkill_type rfkill_type_;
|
2021-02-03 04:17:06 +01:00
|
|
|
bool state_ = false;
|
|
|
|
int fd_ = -1;
|
|
|
|
|
|
|
|
bool on_event(Glib::IOCondition cond);
|
2020-01-23 17:17:29 +01:00
|
|
|
};
|
2020-01-21 17:04:54 +01:00
|
|
|
|
|
|
|
} // namespace waybar::util
|