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