mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor(bluetooth): remove interval
and timer thread
The timer thread was always reading the same value from Rfkill state.
This commit is contained in:
@ -5,13 +5,6 @@
|
||||
waybar::modules::Bluetooth::Bluetooth(const std::string& id, const Json::Value& config)
|
||||
: ALabel(config, "bluetooth", id, "{icon}", 10), rfkill_{RFKILL_TYPE_BLUETOOTH} {
|
||||
rfkill_.on_update.connect(sigc::hide(sigc::mem_fun(*this, &Bluetooth::update)));
|
||||
thread_ = [this] {
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto timeout = std::chrono::floor<std::chrono::seconds>(now + interval_);
|
||||
auto diff = std::chrono::seconds(timeout.time_since_epoch().count() % interval_.count());
|
||||
thread_.sleep_until(timeout - diff);
|
||||
dp.emit();
|
||||
};
|
||||
}
|
||||
|
||||
auto waybar::modules::Bluetooth::update() -> void {
|
||||
|
Reference in New Issue
Block a user