diff --git a/AppImage/components/hardware.tsx b/AppImage/components/hardware.tsx index 980459d..998798a 100644 --- a/AppImage/components/hardware.tsx +++ b/AppImage/components/hardware.tsx @@ -130,6 +130,29 @@ const getMonitoringToolRecommendation = (vendor: string): string => { return "To get extended GPU monitoring information, please install the appropriate GPU monitoring tools for your hardware." } +const improveSensorLabel = (sensorName: string, adapter: string): string => { + const adapterLower = adapter?.toLowerCase() || "" + + // Detect NVIDIA sensors (nouveau or nvidia driver) + if (adapterLower.includes("nouveau") || adapterLower.includes("nvidia")) { + // Improve temperature labels + if (sensorName.toLowerCase().includes("temp")) { + return "NVIDIA GPU Temperature" + } + // Improve fan labels + if (sensorName.toLowerCase().includes("fan")) { + return "NVIDIA GPU Fan" + } + // Improve PWM labels + if (sensorName.toLowerCase().includes("pwm")) { + return "NVIDIA GPU PWM" + } + } + + // Return original name if no improvement needed + return sensorName +} + const groupAndSortTemperatures = (temperatures: any[]) => { const groups = { CPU: [] as any[], @@ -143,7 +166,9 @@ const groupAndSortTemperatures = (temperatures: any[]) => { const nameLower = temp.name.toLowerCase() const adapterLower = temp.adapter?.toLowerCase() || "" - if (nameLower.includes("cpu") || nameLower.includes("core") || nameLower.includes("package")) { + if (adapterLower.includes("nouveau") || adapterLower.includes("nvidia")) { + groups.GPU.push(temp) + } else if (nameLower.includes("cpu") || nameLower.includes("core") || nameLower.includes("package")) { groups.CPU.push(temp) } else if (nameLower.includes("gpu") || adapterLower.includes("gpu")) { groups.GPU.push(temp) @@ -429,218 +454,230 @@ export default function Hardware() { - {(() => { - const groupedTemps = groupAndSortTemperatures(hardwareData.temperatures) +
+ {/* CPU Sensors */} + {groupAndSortTemperatures(hardwareData.temperatures).CPU.length > 0 && ( +
+
+ +

CPU

+ + {groupAndSortTemperatures(hardwareData.temperatures).CPU.length} + +
+
+ {groupAndSortTemperatures(hardwareData.temperatures).CPU.map((temp, index) => { + const percentage = + temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 + const isHot = temp.current > (temp.high || 80) + const isCritical = temp.current > (temp.critical || 90) - return ( -
- {/* CPU Sensors */} - {groupedTemps.CPU.length > 0 && ( -
-
- -

CPU

- - {groupedTemps.CPU.length} - -
-
- {groupedTemps.CPU.map((temp, index) => { - const percentage = - temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 - const isHot = temp.current > (temp.high || 80) - const isCritical = temp.current > (temp.critical || 90) - - return ( -
-
- {temp.name} - - {temp.current.toFixed(1)}°C - -
-
-
-
- {temp.adapter && {temp.adapter}} -
- ) - })} -
-
- )} - - {/* GPU Sensors */} - {groupedTemps.GPU.length > 0 && ( -
1 ? "md:col-span-2" : ""}> -
- -

GPU

- - {groupedTemps.GPU.length} - -
-
1 ? "md:grid-cols-2" : ""}`}> - {groupedTemps.GPU.map((temp, index) => { - const percentage = - temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 - const isHot = temp.current > (temp.high || 80) - const isCritical = temp.current > (temp.critical || 90) - - return ( -
-
- {temp.name} - - {temp.current.toFixed(1)}°C - -
-
-
-
- {temp.adapter && {temp.adapter}} -
- ) - })} -
-
- )} - - {/* NVME Sensors */} - {groupedTemps.NVME.length > 0 && ( -
1 ? "md:col-span-2" : ""}> -
- -

NVME

- - {groupedTemps.NVME.length} - -
-
1 ? "md:grid-cols-2" : ""}`}> - {groupedTemps.NVME.map((temp, index) => { - const percentage = - temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 - const isHot = temp.current > (temp.high || 80) - const isCritical = temp.current > (temp.critical || 90) - - return ( -
-
- {temp.name} - - {temp.current.toFixed(1)}°C - -
-
-
-
- {temp.adapter && {temp.adapter}} -
- ) - })} -
-
- )} - - {/* PCI Sensors */} - {groupedTemps.PCI.length > 0 && ( -
1 ? "md:col-span-2" : ""}> -
- -

PCI

- - {groupedTemps.PCI.length} - -
-
1 ? "md:grid-cols-2" : ""}`}> - {groupedTemps.PCI.map((temp, index) => { - const percentage = - temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 - const isHot = temp.current > (temp.high || 80) - const isCritical = temp.current > (temp.critical || 90) - - return ( -
-
- {temp.name} - - {temp.current.toFixed(1)}°C - -
-
-
-
- {temp.adapter && {temp.adapter}} -
- ) - })} -
-
- )} - - {/* OTHER Sensors */} - {groupedTemps.OTHER.length > 0 && ( -
1 ? "md:col-span-2" : ""}> -
- -

OTHER

- - {groupedTemps.OTHER.length} - -
-
1 ? "md:grid-cols-2" : ""}`}> - {groupedTemps.OTHER.map((temp, index) => { - const percentage = - temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 - const isHot = temp.current > (temp.high || 80) - const isCritical = temp.current > (temp.critical || 90) - - return ( -
-
- {temp.name} - - {temp.current.toFixed(1)}°C - -
-
-
-
- {temp.adapter && {temp.adapter}} -
- ) - })} -
-
- )} + return ( +
+
+ {temp.name} + + {temp.current.toFixed(1)}°C + +
+
+
+
+ {temp.adapter && {temp.adapter}} +
+ ) + })} +
- ) - })()} + )} + + {/* GPU Sensors */} + {groupAndSortTemperatures(hardwareData.temperatures).GPU.length > 0 && ( +
1 ? "md:col-span-2" : ""} + > +
+ +

GPU

+ + {groupAndSortTemperatures(hardwareData.temperatures).GPU.length} + +
+
1 ? "md:grid-cols-2" : ""}`} + > + {groupAndSortTemperatures(hardwareData.temperatures).GPU.map((temp, index) => { + const percentage = + temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 + const isHot = temp.current > (temp.high || 80) + const isCritical = temp.current > (temp.critical || 90) + + const displayName = improveSensorLabel(temp.name, temp.adapter) + + return ( +
+
+ {displayName} + + {temp.current.toFixed(1)}°C + +
+
+
+
+ {temp.adapter && {temp.adapter}} +
+ ) + })} +
+
+ )} + + {/* NVME Sensors */} + {groupAndSortTemperatures(hardwareData.temperatures).NVME.length > 0 && ( +
1 ? "md:col-span-2" : ""} + > +
+ +

NVME

+ + {groupAndSortTemperatures(hardwareData.temperatures).NVME.length} + +
+
1 ? "md:grid-cols-2" : ""}`} + > + {groupAndSortTemperatures(hardwareData.temperatures).NVME.map((temp, index) => { + const percentage = + temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 + const isHot = temp.current > (temp.high || 80) + const isCritical = temp.current > (temp.critical || 90) + + return ( +
+
+ {temp.name} + + {temp.current.toFixed(1)}°C + +
+
+
+
+ {temp.adapter && {temp.adapter}} +
+ ) + })} +
+
+ )} + + {/* PCI Sensors */} + {groupAndSortTemperatures(hardwareData.temperatures).PCI.length > 0 && ( +
1 ? "md:col-span-2" : ""} + > +
+ +

PCI

+ + {groupAndSortTemperatures(hardwareData.temperatures).PCI.length} + +
+
1 ? "md:grid-cols-2" : ""}`} + > + {groupAndSortTemperatures(hardwareData.temperatures).PCI.map((temp, index) => { + const percentage = + temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 + const isHot = temp.current > (temp.high || 80) + const isCritical = temp.current > (temp.critical || 90) + + return ( +
+
+ {temp.name} + + {temp.current.toFixed(1)}°C + +
+
+
+
+ {temp.adapter && {temp.adapter}} +
+ ) + })} +
+
+ )} + + {/* OTHER Sensors */} + {groupAndSortTemperatures(hardwareData.temperatures).OTHER.length > 0 && ( +
1 ? "md:col-span-2" : ""} + > +
+ +

OTHER

+ + {groupAndSortTemperatures(hardwareData.temperatures).OTHER.length} + +
+
1 ? "md:grid-cols-2" : ""}`} + > + {groupAndSortTemperatures(hardwareData.temperatures).OTHER.map((temp, index) => { + const percentage = + temp.critical > 0 ? (temp.current / temp.critical) * 100 : (temp.current / 100) * 100 + const isHot = temp.current > (temp.high || 80) + const isCritical = temp.current > (temp.critical || 90) + + return ( +
+
+ {temp.name} + + {temp.current.toFixed(1)}°C + +
+
+
+
+ {temp.adapter && {temp.adapter}} +
+ ) + })} +
+
+ )} +
)} @@ -1188,10 +1225,12 @@ export default function Hardware() { const isPercentage = fan.unit === "percent" || fan.unit === "%" const percentage = isPercentage ? fan.speed : Math.min((fan.speed / 5000) * 100, 100) + const displayName = improveSensorLabel(fan.name, fan.adapter) + return (
- {fan.name} + {displayName} {isPercentage ? `${fan.speed.toFixed(0)} percent` : `${fan.speed.toFixed(0)} ${fan.unit}`} @@ -1597,27 +1636,54 @@ export default function Hardware() { .filter( (device) => device.type === "disk" && !device.name.startsWith("zd") && !device.name.startsWith("loop"), ) - .map((device, index) => ( -
setSelectedDisk(device)} - className="cursor-pointer rounded-lg border border-white/10 sm:border-border bg-white/5 sm:bg-card sm:hover:bg-white/5 p-3 transition-colors" - > -
- {device.name} - - {device.type} - + .map((device, index) => { + const getDiskTypeBadge = (diskName: string, rotationRate: number | undefined) => { + let diskType = "HDD" + if (diskName.startsWith("nvme")) { + diskType = "NVMe" + } else if (!rotationRate || rotationRate === 0) { + diskType = "SSD" + } + + const badgeStyles: Record = { + NVMe: { + className: "bg-purple-500/10 text-purple-500 border-purple-500/20", + label: "NVMe SSD", + }, + SSD: { + className: "bg-cyan-500/10 text-cyan-500 border-cyan-500/20", + label: "SSD", + }, + HDD: { + className: "bg-blue-500/10 text-blue-500 border-blue-500/20", + label: "HDD", + }, + } + return badgeStyles[diskType] + } + + const diskBadge = getDiskTypeBadge(device.name, device.rotation_rate) + + return ( +
setSelectedDisk(device)} + className="cursor-pointer rounded-lg border border-white/10 sm:border-border bg-white/5 sm:bg-card sm:hover:bg-white/5 p-3 transition-colors" + > +
+ {device.name} + {diskBadge.label} +
+ {device.size &&

{formatMemory(parseLsblkSize(device.size))}

} + {device.model && ( +

{device.model}

+ )} + {device.driver && ( +

Driver: {device.driver}

+ )}
- {device.size &&

{formatMemory(parseLsblkSize(device.size))}

} - {device.model && ( -

{device.model}

- )} - {device.driver && ( -

Driver: {device.driver}

- )} -
- ))} + ) + })}

Click on a device for detailed hardware information