mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
network: Update WiFi information when available
The module doesn't update the `essid_` as soon as a WiFi interface is connected, but that happens at some point later, depending on "interval" configuration. Fix that by rerunning the get WiFi information thread when the `carrier` state changes. Also, we will clear the state related to WiFi when the connection is drop to avoid stale information.
This commit is contained in:
parent
28dfb0ba41
commit
f49a7a1acb
@ -451,6 +451,18 @@ int waybar::modules::Network::handleEvents(struct nl_msg *msg, void *data) {
|
|||||||
net->ifname_ = new_ifname;
|
net->ifname_ = new_ifname;
|
||||||
}
|
}
|
||||||
if (carrier.has_value()) {
|
if (carrier.has_value()) {
|
||||||
|
if (net->carrier_ != *carrier) {
|
||||||
|
if (*carrier) {
|
||||||
|
// Ask for WiFi information
|
||||||
|
net->thread_timer_.wake_up();
|
||||||
|
} else {
|
||||||
|
// clear state related to WiFi connection
|
||||||
|
net->essid_.clear();
|
||||||
|
net->signal_strength_dbm_ = 0;
|
||||||
|
net->signal_strength_ = 0;
|
||||||
|
net->frequency_ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
net->carrier_ = carrier.value();
|
net->carrier_ = carrier.value();
|
||||||
}
|
}
|
||||||
} else if (!is_del_event && net->ifid_ == -1) {
|
} else if (!is_del_event && net->ifid_ == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user