mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 20:44:56 +00:00
When using without argument, make sure that it shows the essid of the first device that has one instead of using the default network device (because most of the times this will be a non-wireless device)
This commit is contained in:
parent
d91214e290
commit
d184efb418
@ -241,7 +241,7 @@ struct text_object *construct_text_object(char *s, const char *arg, long
|
||||
|
||||
#ifdef BUILD_WLAN
|
||||
END OBJ(wireless_essid, &update_net_stats)
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
obj->data.opaque = get_net_stat(arg, obj, free_at_crash);
|
||||
obj->callbacks.print = &print_wireless_essid;
|
||||
END OBJ(wireless_mode, &update_net_stats)
|
||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||
|
@ -226,8 +226,15 @@ void print_wireless_essid(struct text_object *obj, char *p, int p_max_size)
|
||||
{
|
||||
struct net_stat *ns = (struct net_stat *)obj->data.opaque;
|
||||
|
||||
if (!ns)
|
||||
if (!ns) {
|
||||
for(unsigned int i = 0; *(netstats[i].dev) != 0; i++) {
|
||||
if(*(netstats[i].essid) != 0) {
|
||||
snprintf(p, p_max_size, "%s", netstats[i].essid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(p, p_max_size, "%s", ns->essid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user