Add network stats to SystemMonitor, fix ActiveWindow text display
SystemMonitor: add network up/down stats (also added setting to disable it in BarTab) ActiveWindow: add elide if not hovered
This commit is contained in:
parent
724e55c37d
commit
2ebdc74f15
8 changed files with 135 additions and 10 deletions
|
|
@ -14,6 +14,21 @@ Singleton {
|
|||
property real memoryUsageGb: 0
|
||||
property real memoryUsagePer: 0
|
||||
property real diskUsage: 0
|
||||
property real rxSpeed: 0
|
||||
property real txSpeed: 0
|
||||
|
||||
// Helper function to format network speeds
|
||||
function formatSpeed(bytesPerSecond) {
|
||||
if (bytesPerSecond < 1024) {
|
||||
return bytesPerSecond.toFixed(0) + " B/s"
|
||||
} else if (bytesPerSecond < 1024 * 1024) {
|
||||
return (bytesPerSecond / 1024).toFixed(1) + " KB/s"
|
||||
} else if (bytesPerSecond < 1024 * 1024 * 1024) {
|
||||
return (bytesPerSecond / (1024 * 1024)).toFixed(1) + " MB/s"
|
||||
} else {
|
||||
return (bytesPerSecond / (1024 * 1024 * 1024)).toFixed(1) + " GB/s"
|
||||
}
|
||||
}
|
||||
|
||||
// Background process emitting one JSON line per sample
|
||||
Process {
|
||||
|
|
@ -29,6 +44,8 @@ Singleton {
|
|||
root.memoryUsageGb = data.memgb
|
||||
root.memoryUsagePer = data.memper
|
||||
root.diskUsage = data.diskper
|
||||
root.rxSpeed = parseFloat(data.rx_speed) || 0
|
||||
root.txSpeed = parseFloat(data.tx_speed) || 0
|
||||
} catch (e) {
|
||||
|
||||
// ignore malformed lines
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue