mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
small tweak to GPU when temp not available
This commit is contained in:
@@ -323,15 +323,20 @@ Row {
|
|||||||
text: {
|
text: {
|
||||||
if (!SysMonitorService.availableGpus
|
if (!SysMonitorService.availableGpus
|
||||||
|| SysMonitorService.availableGpus.length === 0) {
|
|| SysMonitorService.availableGpus.length === 0) {
|
||||||
return "--°"
|
return "No GPU"
|
||||||
}
|
}
|
||||||
|
|
||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = SysMonitorService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length - 1)]
|
SysMonitorService.availableGpus.length - 1)]
|
||||||
var temp = gpu.temperature
|
var temp = gpu.temperature
|
||||||
return (temp === undefined || temp === null
|
var hasTemp = temp !== undefined && temp !== null && temp !== 0
|
||||||
|| temp === 0) ? "--°" : Math.round(temp) + "°"
|
|
||||||
|
if (hasTemp) {
|
||||||
|
return Math.round(temp) + "°"
|
||||||
|
} else {
|
||||||
|
return gpu.vendor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeLarge
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
@@ -364,7 +369,14 @@ Row {
|
|||||||
var gpu = SysMonitorService.availableGpus[Math.min(
|
var gpu = SysMonitorService.availableGpus[Math.min(
|
||||||
SessionData.selectedGpuIndex,
|
SessionData.selectedGpuIndex,
|
||||||
SysMonitorService.availableGpus.length - 1)]
|
SysMonitorService.availableGpus.length - 1)]
|
||||||
return gpu.vendor + " " + gpu.displayName
|
var temp = gpu.temperature
|
||||||
|
var hasTemp = temp !== undefined && temp !== null && temp !== 0
|
||||||
|
|
||||||
|
if (hasTemp) {
|
||||||
|
return gpu.vendor + " " + gpu.displayName
|
||||||
|
} else {
|
||||||
|
return gpu.displayName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
font.family: SettingsData.monoFontFamily
|
font.family: SettingsData.monoFontFamily
|
||||||
|
|||||||
Reference in New Issue
Block a user