mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
bluetooth module handles rfkill events instantly
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
#include <fmt/chrono.h>
|
||||
#include "util/sleeper_thread.hpp"
|
||||
#include "util/rfkill.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
@ -15,8 +16,10 @@ class Bluetooth : public ALabel {
|
||||
auto update() -> void;
|
||||
|
||||
private:
|
||||
std::string status_;
|
||||
util::SleeperThread thread_;
|
||||
std::string status_;
|
||||
util::SleeperThread thread_;
|
||||
|
||||
util::Rfkill rfkill_;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <sys/epoll.h>
|
||||
#include "ALabel.hpp"
|
||||
#include "util/sleeper_thread.hpp"
|
||||
#include "util/rfkill.hpp"
|
||||
|
||||
namespace waybar::modules {
|
||||
|
||||
@ -71,6 +72,8 @@ class Network : public ALabel {
|
||||
|
||||
util::SleeperThread thread_;
|
||||
util::SleeperThread thread_timer_;
|
||||
|
||||
util::Rfkill rfkill_;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules
|
||||
|
@ -2,8 +2,20 @@
|
||||
|
||||
#include <linux/rfkill.h>
|
||||
|
||||
namespace waybar::util::rfkill {
|
||||
namespace waybar::util {
|
||||
|
||||
bool isDisabled(enum rfkill_type rfkill_type);
|
||||
class Rfkill {
|
||||
public:
|
||||
Rfkill(enum rfkill_type rfkill_type);
|
||||
~Rfkill() = default;
|
||||
bool isDisabled() const;
|
||||
void waitForEvent();
|
||||
int getState();
|
||||
|
||||
private:
|
||||
enum rfkill_type rfkill_type_;
|
||||
int state_ = 0;
|
||||
int prev_state_ = 0;
|
||||
};
|
||||
|
||||
} // namespace waybar::util
|
||||
|
Reference in New Issue
Block a user