remove ws, fmt
This commit is contained in:
parent
5316f40967
commit
cd45c2d9cf
17 changed files with 96 additions and 97 deletions
|
|
@ -21,9 +21,13 @@ Text {
|
|||
if (root._prev) {
|
||||
const dIdle = idle - root._prev.idle;
|
||||
const dTotal = total - root._prev.total;
|
||||
if (dTotal > 0) root.usage = Math.round((1 - dIdle / dTotal) * 100);
|
||||
if (dTotal > 0)
|
||||
root.usage = Math.round((1 - dIdle / dTotal) * 100);
|
||||
}
|
||||
root._prev = { idle, total };
|
||||
root._prev = {
|
||||
idle,
|
||||
total
|
||||
};
|
||||
}
|
||||
}
|
||||
FileView {
|
||||
|
|
@ -31,7 +35,8 @@ Text {
|
|||
path: "/proc/cpuinfo"
|
||||
onLoaded: {
|
||||
const lines = text().split("\n").filter(l => l.startsWith("cpu MHz"));
|
||||
if (lines.length === 0) return;
|
||||
if (lines.length === 0)
|
||||
return;
|
||||
const sum = lines.reduce((a, l) => a + parseFloat(l.split(":")[1]), 0);
|
||||
root.freqGhz = sum / lines.length / 1000;
|
||||
}
|
||||
|
|
@ -40,7 +45,10 @@ Text {
|
|||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: { stat.reload(); cpuinfo.reload(); }
|
||||
onTriggered: {
|
||||
stat.reload();
|
||||
cpuinfo.reload();
|
||||
}
|
||||
}
|
||||
|
||||
text: " " + root.usage.toString().padStart(2) + "%@" + root.freqGhz.toFixed(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue