Top: a long CPU model keeps to its line

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-09-20 23:54:33 -07:00
co-authored by Claude Opus 5
parent 0587f50142
commit ef3dbdf543
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -264,7 +264,9 @@ export default function Top() {
const load = s?.load ?? pt?.load ?? [0, 0, 0]
const mem = s?.mem ?? pt?.mem ?? { total: 0, used: 0, avail: 0 }
const uptime = s?.uptime ?? pt?.uptime ?? 0
const model = (pt?.cpu_model ?? '').replace(/\(R\)|\(TM\)|CPU|Processor/g, '').replace(/\s+/g, ' ').trim()
// "11th Gen Intel(R) Core(TM) i7-11700T @ 1.40GHz" is a whole line of border to itself; the
// clock is already beside it, and the generation is in the model number
const model = (pt?.cpu_model ?? '').replace(/\(R\)|\(TM\)|CPU|Processor/g, '').replace(/@.*$/, '').replace(/^\d+th Gen\s*/i, '').replace(/\s+/g, ' ').trim()
// the hottest thing that looks like a CPU sensor, and one per core where the chip names them
const coreTemp = (i: number) => s?.temps.find((t) => new RegExp(`core ${i}\\b`, 'i').test(t.label))?.c
const cpuTemp = pt?.cpu_temp ?? s?.temps.find((t) => /package|tctl|tdie|cpu/i.test(t.label))?.c ?? coreTemp(0)