diff --git a/sys-info-widget/DesktopWidget.qml b/sys-info-widget/DesktopWidget.qml index 89dab82e..012670c9 100644 --- a/sys-info-widget/DesktopWidget.qml +++ b/sys-info-widget/DesktopWidget.qml @@ -28,6 +28,13 @@ DraggableDesktopWidget { property string rootDisk: pluginApi?.tr("widget.loading") property string homeDisk: pluginApi?.tr("widget.loading") + function getTempColor(tempString) { + let val = parseFloat(tempString.replace(/[^\d.]/g, '')); + if (isNaN(val)) return Color.mOnSurface; + if (val >= 80) return "#ff5555"; // Red + if (val >= 65) return "#f1fa8c"; // Yellow + return "#50fa7b"; // Green + } // --- Data Fetching --- Process { id: distroProc @@ -195,18 +202,42 @@ DraggableDesktopWidget { } // CPU + // CPU Label NText { text: pluginApi?.tr("widget.cpu") color: Color.mOnSurfaceVariant font.pointSize: Style.fontSizeL * widgetScale } - NText { - text: root.cpuUsage + " @ " + root.cpuTemp - color: Color.mOnSurface - font.bold: true - font.pointSize: Style.fontSizeL * widgetScale + + // CPU Values aligned to the right + Row { Layout.fillWidth: true - horizontalAlignment: Text.AlignRight + layoutDirection: Qt.RightToLeft + spacing: Style.marginS // Using Style singleton instead of hardcoded 4 + + // Temperature (Colored via native property) + NText { + text: root.cpuTemp + color: root.getTempColor(root.cpuTemp) + font.bold: true + font.pointSize: Style.fontSizeL * widgetScale + } + + // Separator (Translated) + NText { + // Ensure "widget.separator_at" is defined in your i18n files as "@" + text: pluginApi?.tr("widget.separator_at") + color: Color.mOnSurface + font.pointSize: Style.fontSizeL * widgetScale + } + + // Usage + NText { + text: root.cpuUsage + color: Color.mOnSurface + font.bold: true + font.pointSize: Style.fontSizeL * widgetScale + } } // Memory diff --git a/sys-info-widget/i18n/en.json b/sys-info-widget/i18n/en.json index fea15926..40645414 100644 --- a/sys-info-widget/i18n/en.json +++ b/sys-info-widget/i18n/en.json @@ -4,6 +4,7 @@ "kernel": "Kernel", "uptime": "Uptime", "cpu": "CPU", + "separator_at": "@", "memory": "Memory", "disk_root": "Disk /", "disk_home": "Disk /home", diff --git a/sys-info-widget/manifest.json b/sys-info-widget/manifest.json index bae5f467..de8228bc 100644 --- a/sys-info-widget/manifest.json +++ b/sys-info-widget/manifest.json @@ -1,7 +1,7 @@ { "id": "sys-info-widget", "name": "System Info", - "version": "1.0.4", + "version": "1.0.5", "minNoctaliaVersion": "4.6.6", "author": "Simon", "license": "MIT", diff --git a/sys-info-widget/preview.png b/sys-info-widget/preview.png index 8fcf493f..dbd81271 100644 Binary files a/sys-info-widget/preview.png and b/sys-info-widget/preview.png differ