mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2025-12-06 06:36:15 +00:00
Merge branch 'main' of github.com:noctalia-dev/noctalia-shell
This commit is contained in:
@@ -40,8 +40,6 @@ RowLayout {
|
||||
!== undefined) ? widgetSettings.showNetworkStats : widgetMetadata.showNetworkStats
|
||||
readonly property bool showDiskUsage: (widgetSettings.showDiskUsage
|
||||
!== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage
|
||||
readonly property bool showGpuTemp: (widgetSettings.showGpuTemp !== undefined) ? widgetSettings.showGpuTemp : (widgetMetadata.showGpuTemp
|
||||
|| false)
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: Style.marginS * scaling
|
||||
@@ -121,36 +119,6 @@ RowLayout {
|
||||
}
|
||||
}
|
||||
|
||||
// GPU Temperature Component
|
||||
Item {
|
||||
Layout.preferredWidth: gpuTempRow.implicitWidth
|
||||
Layout.preferredHeight: Math.round(Style.capsuleHeight * scaling)
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: showGpuTemp
|
||||
|
||||
RowLayout {
|
||||
id: gpuTempRow
|
||||
anchors.centerIn: parent
|
||||
spacing: Style.marginXS * scaling
|
||||
|
||||
NIcon {
|
||||
icon: "gpu-temperature"
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
NText {
|
||||
text: `${SystemStatService.gpuTemp}°C`
|
||||
font.family: Settings.data.ui.fontFixed
|
||||
font.pointSize: Style.fontSizeXS * scaling
|
||||
font.weight: Style.fontWeightMedium
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Memory Usage Component
|
||||
Item {
|
||||
Layout.preferredWidth: memoryUsageRow.implicitWidth
|
||||
|
||||
@@ -16,8 +16,6 @@ ColumnLayout {
|
||||
// Local, editable state for checkboxes
|
||||
property bool valueShowCpuUsage: widgetData.showCpuUsage !== undefined ? widgetData.showCpuUsage : widgetMetadata.showCpuUsage
|
||||
property bool valueShowCpuTemp: widgetData.showCpuTemp !== undefined ? widgetData.showCpuTemp : widgetMetadata.showCpuTemp
|
||||
property bool valueShowGpuTemp: widgetData.showGpuTemp !== undefined ? widgetData.showGpuTemp : (widgetMetadata.showGpuTemp
|
||||
|| false)
|
||||
property bool valueShowMemoryUsage: widgetData.showMemoryUsage !== undefined ? widgetData.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
property bool valueShowMemoryAsPercent: widgetData.showMemoryAsPercent
|
||||
!== undefined ? widgetData.showMemoryAsPercent : widgetMetadata.showMemoryAsPercent
|
||||
@@ -29,7 +27,6 @@ ColumnLayout {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.showCpuUsage = valueShowCpuUsage
|
||||
settings.showCpuTemp = valueShowCpuTemp
|
||||
settings.showGpuTemp = valueShowGpuTemp
|
||||
settings.showMemoryUsage = valueShowMemoryUsage
|
||||
settings.showMemoryAsPercent = valueShowMemoryAsPercent
|
||||
settings.showNetworkStats = valueShowNetworkStats
|
||||
@@ -53,14 +50,6 @@ ColumnLayout {
|
||||
onToggled: checked => valueShowCpuTemp = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
id: showGpuTemp
|
||||
Layout.fillWidth: true
|
||||
label: "GPU temperature"
|
||||
checked: valueShowGpuTemp
|
||||
onToggled: checked => valueShowGpuTemp = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
id: showMemoryUsage
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -81,7 +81,6 @@ Singleton {
|
||||
"allowUserSettings": true,
|
||||
"showCpuUsage": true,
|
||||
"showCpuTemp": true,
|
||||
"showGpuTemp": false,
|
||||
"showMemoryUsage": true,
|
||||
"showMemoryAsPercent": false,
|
||||
"showNetworkStats": false,
|
||||
|
||||
@@ -12,7 +12,6 @@ Singleton {
|
||||
// Public values
|
||||
property real cpuUsage: 0
|
||||
property real cpuTemp: 0
|
||||
property real gpuTemp: 0
|
||||
property real memGb: 0
|
||||
property real memPercent: 0
|
||||
property real diskPercent: 0
|
||||
@@ -36,12 +35,6 @@ Singleton {
|
||||
readonly property var supportedTempCpuSensorNames: ["coretemp", "k10temp", "zenpower"]
|
||||
property string cpuTempSensorName: ""
|
||||
property string cpuTempHwmonPath: ""
|
||||
// Gpu temperature (simple hwmon read if available)
|
||||
readonly property var supportedTempGpuSensorNames: ["amdgpu", "nvidia", "radeon"]
|
||||
property string gpuTempSensorName: ""
|
||||
property string gpuTempHwmonPath: ""
|
||||
property bool gpuIsDedicated: false
|
||||
property string _gpuPendingAmdPath: ""
|
||||
// For Intel coretemp averaging of all cores/sensors
|
||||
property var intelTempValues: []
|
||||
property int intelTempFilesChecked: 0
|
||||
@@ -73,7 +66,6 @@ Singleton {
|
||||
dfProcess.running = true
|
||||
|
||||
updateCpuTemperature()
|
||||
updateGpuTemperature()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,108 +184,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// --------------------------------------------
|
||||
// ---- GPU temperature detection (hwmon)
|
||||
FileView {
|
||||
id: gpuTempNameReader
|
||||
property int currentIndex: 0
|
||||
printErrors: false
|
||||
|
||||
function checkNext() {
|
||||
if (currentIndex >= 16) {
|
||||
// Check up to hwmon10
|
||||
Logger.warn("SystemStat", "No supported GPU temperature sensor found")
|
||||
return
|
||||
}
|
||||
|
||||
gpuTempNameReader.path = `/sys/class/hwmon/hwmon${currentIndex}/name`
|
||||
gpuTempNameReader.reload()
|
||||
}
|
||||
|
||||
Component.onCompleted: checkNext()
|
||||
|
||||
onLoaded: {
|
||||
const name = text().trim()
|
||||
if (root.supportedTempGpuSensorNames.includes(name)) {
|
||||
const hwPath = `/sys/class/hwmon/hwmon${currentIndex}`
|
||||
if (name === "nvidia") {
|
||||
// Treat NVIDIA as dedicated by default
|
||||
root.gpuTempSensorName = name
|
||||
root.gpuTempHwmonPath = hwPath
|
||||
root.gpuIsDedicated = true
|
||||
Logger.log("SystemStat", `Selected NVIDIA GPU thermal sensor at ${root.gpuTempHwmonPath}`)
|
||||
} else if (name === "amdgpu") {
|
||||
// Probe VRAM to distinguish dGPU vs iGPU
|
||||
root._gpuPendingAmdPath = hwPath
|
||||
vramReader.requestCheck(hwPath)
|
||||
} else if (!root.gpuTempHwmonPath) {
|
||||
// Fallback to first supported sensor (e.g., radeon)
|
||||
root.gpuTempSensorName = name
|
||||
root.gpuTempHwmonPath = hwPath
|
||||
Logger.log("SystemStat", `Selected GPU thermal sensor at ${root.gpuTempHwmonPath}`)
|
||||
}
|
||||
} else {
|
||||
currentIndex++
|
||||
Qt.callLater(() => {
|
||||
checkNext()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onLoadFailed: function (error) {
|
||||
currentIndex++
|
||||
Qt.callLater(() => {
|
||||
checkNext()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Reader to detect AMD dGPU by checking VRAM presence
|
||||
FileView {
|
||||
id: vramReader
|
||||
property string targetHwmonPath: ""
|
||||
function requestCheck(hwPath) {
|
||||
targetHwmonPath = hwPath
|
||||
vramReader.path = `${hwPath}/device/mem_info_vram_total`
|
||||
vramReader.reload()
|
||||
}
|
||||
printErrors: false
|
||||
onLoaded: {
|
||||
const val = parseInt(text().trim())
|
||||
// If VRAM present (>0), prefer this as dGPU
|
||||
if (!isNaN(val) && val > 0) {
|
||||
root.gpuTempSensorName = "amdgpu"
|
||||
root.gpuTempHwmonPath = targetHwmonPath
|
||||
root.gpuIsDedicated = true
|
||||
Logger.log("SystemStat",
|
||||
`Selected AMD dGPU (VRAM=${Math.round(val / (1024 * 1024 * 1024))}GB) at ${root.gpuTempHwmonPath}`)
|
||||
} else if (!root.gpuTempHwmonPath) {
|
||||
// Use as fallback iGPU if nothing selected yet
|
||||
root.gpuTempSensorName = "amdgpu"
|
||||
root.gpuTempHwmonPath = targetHwmonPath
|
||||
root.gpuIsDedicated = false
|
||||
Logger.log("SystemStat", `Selected AMD GPU (no VRAM) at ${root.gpuTempHwmonPath}`)
|
||||
}
|
||||
// Continue scanning other hwmon entries
|
||||
gpuTempNameReader.currentIndex++
|
||||
Qt.callLater(() => {
|
||||
gpuTempNameReader.checkNext()
|
||||
})
|
||||
}
|
||||
onLoadFailed: function (error) {
|
||||
// If failed to read VRAM, consider as fallback if none selected
|
||||
if (!root.gpuTempHwmonPath) {
|
||||
root.gpuTempSensorName = "amdgpu"
|
||||
root.gpuTempHwmonPath = targetHwmonPath
|
||||
}
|
||||
gpuTempNameReader.currentIndex++
|
||||
Qt.callLater(() => {
|
||||
gpuTempNameReader.checkNext()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
// -------------------------------------------------------
|
||||
// Parse memory info from /proc/meminfo
|
||||
@@ -459,26 +349,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
// Function to start/refresh the GPU temperature
|
||||
function updateGpuTemperature() {
|
||||
if (!root.gpuTempHwmonPath)
|
||||
return
|
||||
gpuTempReader.path = `${root.gpuTempHwmonPath}/temp1_input`
|
||||
gpuTempReader.reload()
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: gpuTempReader
|
||||
printErrors: false
|
||||
onLoaded: {
|
||||
const data = parseInt(text().trim())
|
||||
if (!isNaN(data)) {
|
||||
root.gpuTemp = Math.round(data / 1000.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
// Function to check next Intel temperature sensor
|
||||
function checkNextIntelTemp() {
|
||||
|
||||
Reference in New Issue
Block a user