From 904afa2537705e1e537f550ab30fc20068ac44d5 Mon Sep 17 00:00:00 2001 From: quadbyte Date: Tue, 12 Aug 2025 11:28:42 -0400 Subject: [PATCH] Sysmon script + renaming cards so its easier to know what they do --- Bin/sysmon.sh | 50 +++++++++++++++++++ ...rProfileCard.qml => PowerProfilesCard.qml} | 0 .../{SystemCard.qml => SystemMonitorCard.qml} | 0 Modules/SidePanel/SidePanel.qml | 6 ++- Widgets/NIconButton.qml | 7 ++- 5 files changed, 57 insertions(+), 6 deletions(-) create mode 100755 Bin/sysmon.sh rename Modules/SidePanel/Cards/{PowerProfileCard.qml => PowerProfilesCard.qml} (100%) rename Modules/SidePanel/Cards/{SystemCard.qml => SystemMonitorCard.qml} (100%) diff --git a/Bin/sysmon.sh b/Bin/sysmon.sh new file mode 100755 index 0000000..d91b88c --- /dev/null +++ b/Bin/sysmon.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# A script to display CPU temperature, CPU usage, memory usage, and disk usage without the 'sensors' package. + +echo "--- System Metrics ---" + +# Get CPU Temperature in Celsius from a kernel file. +# This method is more common on modern systems but may vary. +# It reads the temperature from the first available core. +# Function to get CPU temperature + + # Check for the common thermal zone path + if [ -f "/sys/class/thermal/thermal_zone0/temp" ]; then + temp_file="/sys/class/thermal/thermal_zone0/temp" + # Check for a different thermal zone path (e.g., some older systems) + elif [ -f "/sys/class/hwmon/hwmon0/temp1_input" ]; then + temp_file="/sys/class/hwmon/hwmon0/temp1_input" + else + echo "Error: Could not find a CPU temperature file." + exit 1 + fi + + # Read the raw temperature value + raw_temp=$(cat "$temp_file") + + # The value is usually in millidegrees Celsius, so we divide by 1000. + # We use 'bc' for floating-point arithmetic. + temp_celsius=$(echo "scale=2; $raw_temp / 1000" | bc) + + echo "CPU Temperature: ${temp_celsius}°C" + + +# Get CPU Usage +# 'top' is a standard utility for this. It gives a real-time view of system processes. +cpu_usage=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}') +echo "CPU Usage: ${cpu_usage}%" + +# Get Memory Usage +# 'free' provides information about memory usage. +mem_total=$(free | grep Mem | awk '{print $2}') +mem_used=$(free | grep Mem | awk '{print $3}') +mem_usage=$(echo "scale=2; ($mem_used/$mem_total)*100" | bc) +echo "Memory Usage: ${mem_usage}%" + +# Get Disk Usage +# 'df' reports file system disk space usage. We check the root directory. +disk_usage=$(df -h / | grep / | awk '{print $5}' | sed 's/%//g') +echo "Disk Usage: ${disk_usage}%" + +echo "----------------------" \ No newline at end of file diff --git a/Modules/SidePanel/Cards/PowerProfileCard.qml b/Modules/SidePanel/Cards/PowerProfilesCard.qml similarity index 100% rename from Modules/SidePanel/Cards/PowerProfileCard.qml rename to Modules/SidePanel/Cards/PowerProfilesCard.qml diff --git a/Modules/SidePanel/Cards/SystemCard.qml b/Modules/SidePanel/Cards/SystemMonitorCard.qml similarity index 100% rename from Modules/SidePanel/Cards/SystemCard.qml rename to Modules/SidePanel/Cards/SystemMonitorCard.qml diff --git a/Modules/SidePanel/SidePanel.qml b/Modules/SidePanel/SidePanel.qml index c8936d8..5b0a5c6 100644 --- a/Modules/SidePanel/SidePanel.qml +++ b/Modules/SidePanel/SidePanel.qml @@ -110,7 +110,7 @@ NLoader { } // System monitors combined in one card - SystemCard { + SystemMonitorCard { id: statsCard } } @@ -122,8 +122,10 @@ NLoader { Layout.bottomMargin: 0 spacing: sidePanel.cardSpacing - PowerProfileCard {} + // Power Profiles switcher + PowerProfilesCard {} + // Utilities buttons UtilitiesCard {} } } diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index 825eadb..04de320 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -37,14 +37,13 @@ Rectangle { text: root.icon font.family: fontFamily font.pointSize: root.fontPointSize * scaling - font.variableAxes: { - "wght": (Font.Normal + Font.Bold) / 2.0 - } + font.variableAxes: { + "wght": (Font.Normal + Font.Bold) / 2.0 + } color: root.hovering ? Colors.onAccent : showBorder ? Colors.accentPrimary : Colors.textPrimary horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter opacity: root.enabled ? Style.opacityFull : Style.opacityMedium - } NTooltip {