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