File: rfkill.hpp

package info (click to toggle)
waybar 0.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,464 kB
  • sloc: cpp: 25,331; xml: 742; python: 146; ansic: 77; makefile: 29
file content (28 lines) | stat: -rw-r--r-- 525 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <glibmm/iochannel.h>
#include <linux/rfkill.h>
#include <sigc++/signal.h>
#include <sigc++/trackable.h>

#include <atomic>

namespace waybar::util {

class Rfkill : public sigc::trackable {
 public:
  Rfkill(enum rfkill_type rfkill_type);
  ~Rfkill();
  bool getState() const;

  sigc::signal<void(struct rfkill_event&)> on_update;

 private:
  enum rfkill_type rfkill_type_;
  std::atomic_bool state_ = false;
  int fd_ = -1;

  bool on_event(Glib::IOCondition cond);
};

}  // namespace waybar::util