mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: added an option to show ICMP status and latency in the text widget (allows to show ping latency in the menu bar)
This commit is contained in:
@@ -294,6 +294,13 @@ public class Network: Module {
|
||||
}
|
||||
case "$type":
|
||||
replacement = value.connectionType?.rawValue ?? "-"
|
||||
case "$icmp":
|
||||
guard let connectivity = self.connectivityReader?.value else { return }
|
||||
switch pair.value {
|
||||
case "status": replacement = localizedString(connectivity.status ? "UP" : "DOWN")
|
||||
case "latency": replacement = "\(Int(connectivity.latency)) ms"
|
||||
default: return
|
||||
}
|
||||
default: return
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ You can use a combination of any of the variables. There is only one limitation:
|
||||
<li><b>$download.total</b>: <small>Total amount of data downloaded over the connection.</small></li>
|
||||
<li><b>$download</b>: <small>Current download bandwidth used.</small></li>
|
||||
<li><b>$type</b>: <small>Type of network connection (e.g., Ethernet, Wi-Fi, Cellular).</small></li>
|
||||
<li><b>$icmp.status</b>: <small>ICMP status.</small></li>
|
||||
<li><b>$icmp.latency</b>: <small>ICMP latency.</small></li>
|
||||
</ul>
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user