diff --git a/src/modules/network.cpp b/src/modules/network.cpp index cca1d50..586cca2 100644 --- a/src/modules/network.cpp +++ b/src/modules/network.cpp @@ -25,7 +25,6 @@ waybar::modules::Network::Network(const std::string &id, const Json::Value &conf ifname_ = ifname; getInterfaceAddress(); } - dp.emit(); worker(); } @@ -461,14 +460,12 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) { net->linked_ = true; net->ifname_ = ifname; net->ifid_ = rtif->ifi_index; - net->dp.emit(); } // Check for valid interface if (rtif->ifi_index == static_cast(net->ifid_)) { // Get Iface and WIFI info - net->thread_timer_.wake_up(); net->getInterfaceAddress(); - net->dp.emit(); + net->thread_timer_.wake_up(); } } else if (nh->nlmsg_type == RTM_DELADDR) { auto rtif = static_cast(NLMSG_DATA(nh)); @@ -499,10 +496,11 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) { // Check for a new interface and get info auto new_iface = net->getPreferredIface(); if (new_iface != -1) { - net->thread_timer_.wake_up(); net->getInterfaceAddress(); + net->thread_timer_.wake_up(); + } else { + net->dp.emit(); } - net->dp.emit(); } } return NL_SKIP;