mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Handle screens disconnection (#29)
This commit is contained in:
@ -29,8 +29,10 @@ waybar::modules::Network::Network(Json::Value config)
|
||||
}
|
||||
}
|
||||
label_.set_name("network");
|
||||
// Trigger first values
|
||||
getInfo();
|
||||
Glib::signal_idle().connect_once(sigc::mem_fun(*this, &Network::update));
|
||||
update();
|
||||
thread_.sig_update.connect(sigc::mem_fun(*this, &Network::update));
|
||||
thread_ = [this] {
|
||||
char buf[4096];
|
||||
uint64_t len = netlinkResponse(sock_fd_, buf, sizeof(buf),
|
||||
@ -67,11 +69,16 @@ waybar::modules::Network::Network(Json::Value config)
|
||||
}
|
||||
if (need_update) {
|
||||
getInfo();
|
||||
Glib::signal_idle().connect_once(sigc::mem_fun(*this, &Network::update));
|
||||
thread_.sig_update.emit();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
waybar::modules::Network::~Network()
|
||||
{
|
||||
close(sock_fd_);
|
||||
}
|
||||
|
||||
auto waybar::modules::Network::update() -> void
|
||||
{
|
||||
auto format = config_["format"] ? config_["format"].asString() : "{ifname}";
|
||||
|
Reference in New Issue
Block a user