Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions sys-info-widget/DesktopWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sys-info-widget/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"kernel": "Kernel",
"uptime": "Uptime",
"cpu": "CPU",
"separator_at": "@",
"memory": "Memory",
"disk_root": "Disk /",
"disk_home": "Disk /home",
Expand Down
2 changes: 1 addition & 1 deletion sys-info-widget/manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Binary file modified sys-info-widget/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.