openbsd wifi status

This commit is contained in:
Venelin Dechkov
2026-07-30 11:54:49 +03:00
parent 61b65db6eb
commit 695a141ae0
+18 -1
View File
@@ -114,6 +114,7 @@ extern "C"
try try
{ {
// Net // Net
#if defined(__linux__)
for(const auto& dir_entry: fs::directory_iterator("/sys/class/net")) for(const auto& dir_entry: fs::directory_iterator("/sys/class/net"))
{ {
string interface_state; string interface_state;
@@ -142,6 +143,19 @@ extern "C"
break; break;
} }
} }
#else
if(const char* ssid = wifi_essid("iwn0"); ssid)
{
new_stat += "🛜";
new_stat += ssid;
}
new_stat += ' ';
if(const char* perc = wifi_perc("iwn0"); perc)
{
new_stat += perc;
new_stat += "% ";
}
#endif
// Battery // Battery
string charge; string charge;
@@ -215,8 +229,11 @@ extern "C"
updatestatus(); updatestatus();
next_update = now + 10s; next_update = now + 10s;
} }
else if(now > next_update) else if(!has_child && now > next_update)
{ {
// Clean up all zombies
while (waitpid(-1, nullptr, WNOHANG) > 0);
updatestatus(); updatestatus();
next_update = now + 10s; next_update = now + 10s;
} }