status wifi not connected
This commit is contained in:
@@ -2155,10 +2155,6 @@ main(int argc, char *argv[])
|
|||||||
die("dwm: cannot open display");
|
die("dwm: cannot open display");
|
||||||
checkotherwm();
|
checkotherwm();
|
||||||
setup();
|
setup();
|
||||||
#ifdef __OpenBSD__
|
|
||||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
|
||||||
die("pledge");
|
|
||||||
#endif /* __OpenBSD__ */
|
|
||||||
scan();
|
scan();
|
||||||
run();
|
run();
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|||||||
@@ -127,19 +127,27 @@ extern "C"
|
|||||||
new_stat += "🌐 ";
|
new_stat += "🌐 ";
|
||||||
break;
|
break;
|
||||||
case 'w': // 'w' means wifi
|
case 'w': // 'w' means wifi
|
||||||
ifstream(dir_entry.path() / "operstate") >> interface_state;
|
if(const char* ssid = wifi_essid(interface.c_str()); ssid) // Connected
|
||||||
if(interface_state == "up")
|
|
||||||
{
|
{
|
||||||
|
// State
|
||||||
new_stat += "🛜";
|
new_stat += "🛜";
|
||||||
if(const char* ssid = wifi_essid(interface.c_str()); ssid)
|
|
||||||
new_stat += ssid;
|
new_stat += ssid;
|
||||||
new_stat += ' ';
|
new_stat += ' ';
|
||||||
|
|
||||||
|
// Quality percent
|
||||||
if(const char* perc = wifi_perc(interface.c_str()); perc)
|
if(const char* perc = wifi_perc(interface.c_str()); perc)
|
||||||
{
|
{
|
||||||
new_stat += perc;
|
new_stat += perc;
|
||||||
new_stat += "% ";
|
new_stat += "% ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // Disconnected
|
||||||
|
{
|
||||||
|
string wifi_state;
|
||||||
|
ifstream(dir_entry.path() / "flags") >> wifi_state;
|
||||||
|
if( wifi_state == "0x1003")
|
||||||
|
new_stat += "📡 ";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,13 +156,14 @@ extern "C"
|
|||||||
{
|
{
|
||||||
new_stat += "🛜";
|
new_stat += "🛜";
|
||||||
new_stat += ssid;
|
new_stat += ssid;
|
||||||
}
|
|
||||||
new_stat += ' ';
|
new_stat += ' ';
|
||||||
|
|
||||||
if(const char* perc = wifi_perc("iwn0"); perc)
|
if(const char* perc = wifi_perc("iwn0"); perc)
|
||||||
{
|
{
|
||||||
new_stat += perc;
|
new_stat += perc;
|
||||||
new_stat += "% ";
|
new_stat += "% ";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
|
|||||||
Reference in New Issue
Block a user