#!/bin/bash

# An example script for the genmon plugin displaying information on the CPU

echo "<img>/usr/share/icons/Adwaita/scalable/apps/utilities-system-monitor-symbolic.svg
</img>"

declare -i cpuFreq
cpuFreq=$(cat /proc/cpuinfo | grep "cpu MHz" | sed 's/\ \ */ /g' | cut -f3 -d" " | cut -f1 -d".")

if [ $cpuFreq -ge 1000 ]
then
  cpu=$(echo $cpuFreq | cut -c1).$(echo $cpuFreq | cut -c2)GHz
else
  cpu=MHz
fi
echo "<txt>"$(cat /proc/acpi/thermal_zone/THM/temperature | sed 's/\ \ */ /g' | cut -f2 -d" ")"°C</txt>"
echo "<tool>Freq: "$cpu"</tool>"
