status wifi not connected

This commit is contained in:
Venelin Dechkov
2026-07-30 11:54:49 +03:00
parent 0ab423c983
commit c094e542d9
2 changed files with 19 additions and 14 deletions
-4
View File
@@ -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();
+19 -10
View File
@@ -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 += 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,12 +156,13 @@ extern "C"
{
new_stat += "🛜";
new_stat += ssid;
}
new_stat += ' ';
if(const char* perc = wifi_perc("iwn0"); perc)
{
new_stat += perc;
new_stat += "% ";
new_stat += ' ';
if(const char* perc = wifi_perc("iwn0"); perc)
{
new_stat += perc;
new_stat += "% ";
}
}
#endif