waybar/include/modules/bluetooth.hpp
Aleksei Bavshin 38c29fc242
refactor(rfkill): poll rfkill events from Glib main loop
Open rfkill device only once per module.
Remove rfkill threads and use `Glib::signal_io` as a more efficient way
to poll the rfkill device.
Handle runtime errors from rfkill and stop polling of the device instead
of crashing waybar.
2021-02-09 21:27:19 -08:00

25 lines
464 B
C++

#pragma once
#include <fmt/chrono.h>
#include <fmt/format.h>
#include "ALabel.hpp"
#include "util/rfkill.hpp"
#include "util/sleeper_thread.hpp"
namespace waybar::modules {
class Bluetooth : public ALabel {
public:
Bluetooth(const std::string&, const Json::Value&);
~Bluetooth() = default;
auto update() -> void;
private:
std::string status_;
util::SleeperThread thread_;
util::Rfkill rfkill_;
};
} // namespace waybar::modules