1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 21:45:38 -05:00

lighter sysmon script

This commit is contained in:
bbedward
2025-08-09 00:07:43 -04:00
parent 8a4db0b3d7
commit b65917113a
5 changed files with 288 additions and 59 deletions

View File

@@ -42,12 +42,72 @@ PanelWindow {
})
})
})
// Configure GPU temperature monitoring based on widget configuration
updateGpuTempConfig()
}
function updateGpuTempConfig() {
const allWidgets = [...(SettingsData.topBarLeftWidgets || []),
...(SettingsData.topBarCenterWidgets || []),
...(SettingsData.topBarRightWidgets || [])]
const hasGpuTempWidget = allWidgets.some(widget => {
const widgetId = typeof widget === "string" ? widget : widget.id
const widgetEnabled = typeof widget === "string" ? true : (widget.enabled !== false)
return widgetId === "gpuTemp" && widgetEnabled
})
let hasNvidiaGpuWidget = false
let hasNonNvidiaGpuWidget = false
if (hasGpuTempWidget) {
hasNvidiaGpuWidget = allWidgets.some(widget => {
const widgetId = typeof widget === "string" ? widget : widget.id
const widgetEnabled = typeof widget === "string" ? true : (widget.enabled !== false)
if (widgetId !== "gpuTemp" || !widgetEnabled) return false
const selectedGpuIndex = typeof widget === "string" ? 0 : (widget.selectedGpuIndex || 0)
if (SysMonitorService.availableGpus && SysMonitorService.availableGpus[selectedGpuIndex]) {
return SysMonitorService.availableGpus[selectedGpuIndex].driver === "nvidia"
}
return false
})
hasNonNvidiaGpuWidget = allWidgets.some(widget => {
const widgetId = typeof widget === "string" ? widget : widget.id
const widgetEnabled = typeof widget === "string" ? true : (widget.enabled !== false)
if (widgetId !== "gpuTemp" || !widgetEnabled) return false
const selectedGpuIndex = typeof widget === "string" ? 0 : (widget.selectedGpuIndex || 0)
if (SysMonitorService.availableGpus && SysMonitorService.availableGpus[selectedGpuIndex]) {
return SysMonitorService.availableGpus[selectedGpuIndex].driver !== "nvidia"
}
return true
})
}
SysMonitorService.gpuTempEnabled = hasGpuTempWidget
SysMonitorService.nvidiaGpuTempEnabled = hasNvidiaGpuWidget
SysMonitorService.nonNvidiaGpuTempEnabled = hasNonNvidiaGpuWidget
}
Connections {
function onTopBarTransparencyChanged() {
root.backgroundTransparency = SettingsData.topBarTransparency
}
function onTopBarLeftWidgetsChanged() {
root.updateGpuTempConfig()
}
function onTopBarCenterWidgetsChanged() {
root.updateGpuTempConfig()
}
function onTopBarRightWidgetsChanged() {
root.updateGpuTempConfig()
}
target: SettingsData
}