You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
924 B
Bash

#!/bin/sh
case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e gotop ;;
3) notify-send "📰 Temperature module" "\- Shows Cpu temps items
- Left click opens gotop" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
info=$(sensors)
temps=$(echo "$info" | grep "°C" | sed -r 's/^.*\+([0-9]+)\.[0-9]°C.*\(.*\).*$/\1/g')
fan=$(echo "$info" | grep "RPM" | sed -r 's/^.* ([0-9]+ RPM)/\1/g')
rec="0"
temps="$(for temp in $temps; do
[ "$temp" -gt "$rec" ] && rec="$temp"
echo $rec
done | tac | sed 1q)"
if [ "$temps" -gt "80" ]; then
temps=$(echo "<span foreground=\"#cc241d\">$temps°C</span>")
icon=""
elif [ "$temps" -gt "50" ];then
temps=$(echo "<span foreground=\"#d79921\">$temps°C</span>")
icon=""
else
temps=$(echo "<span foreground=\"#98971a\">$temps°C</span>")
icon=""
fi
#echo "$temps"
printf "%s %s  %s\\n" "$icon" "$temps" "$fan"