openbsd wifi status
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user