Sysmon script + renaming cards so its easier to know what they do
This commit is contained in:
parent
eff47f504f
commit
904afa2537
5 changed files with 57 additions and 6 deletions
50
Bin/sysmon.sh
Executable file
50
Bin/sysmon.sh
Executable file
|
|
@ -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 "----------------------"
|
||||
|
|
@ -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 {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue