1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

Userland: Add network adapter link status to SystemMonitor and applet

Add a column named 'Link status' to the Network tab in SystemMonitor
showing the speed and duplex if the link is up.
Add the link speed behind the existing text in the applet or show
'down' if the link is down.
This commit is contained in:
Thomas Wagenveld 2021-07-28 14:23:39 +02:00 committed by Gunnar Beutner
parent 32c8d35ef0
commit 3a40287776
2 changed files with 15 additions and 1 deletions

View file

@ -124,6 +124,8 @@ private:
auto& if_object = value.as_object();
auto ip_address = if_object.get("ipv4_address").to_string();
auto ifname = if_object.get("name").to_string();
auto link_up = if_object.get("link_up").as_bool();
auto link_speed = if_object.get("link_speed").to_i32();
if (!include_loopback)
if (ifname == "loop")
@ -134,7 +136,11 @@ private:
if (!adapter_info.is_empty())
adapter_info.append('\n');
adapter_info.appendff("{}: {}", ifname, ip_address);
adapter_info.appendff("{}: {} ", ifname, ip_address);
if (!link_up)
adapter_info.appendff("(down)");
else
adapter_info.appendff("({} Mb/s)", link_speed);
});
// show connected icon so long as at least one adapter is connected