added initial

This commit is contained in:
Tobias Schmidl 2020-09-21 08:06:32 +02:00
parent 28eceec1a7
commit f8061c5ea7

72
system.sh Executable file
View file

@ -0,0 +1,72 @@
#! /bin/bash
PURPLE_GREEN_THEME=("#762a83" "#9970ab" "#c2a5cf" "#a6dba0" "#5aae61" "#1b7837")
RED_GREEN_THEME=("#d73027" "#fc8d59" "#fee08b" "#d9ef8b" "#91cf60" "#1a9850")
ORIGINAL_THEME=("#acacac" "#ff0101" "#cc673b" "#ce8458" "#6bbb15" "#0ed812")
COLORS=(${RED_GREEN_THEME[@]})
LOADAVG=$(cut -d' ' -f 1-3 /proc/loadavg)
CORES=$(grep -c processor /proc/cpuinfo)
LOAD_PER_CORE=$(echo "${LOADAVG% * *} 100 * $CORES / p" | dc)
case $LOAD_PER_CORE in
[0-9]|[0-4][0-9])
COLOR="${COLORS[5]}"
;;
[5-6][0-9])
COLOR="${COLORS[4]}"
;;
[7-8][0-9])
COLOR="${COLORS[3]}"
;;
[9][0-9]|10[0-9])
COLOR="${COLORS[2]}"
;;
1[1-9][0-9])
COLOR="${COLORS[1]}"
;;
*)
COLOR="${COLORS[0]}"
;;
esac
echo "${LOADAVG} | color=$COLOR"
echo "------"
[ "$ARGOS_MENU_OPEN" == "false" ] && exit 0;
echo "<span size=\"large\" font_weight=\"bold\">Disks</span>"
IFS=$'\n';
for a in `df -h | sed -n '/\/snap/d;/% *\//p' | sort -n --reverse -k 5,5 | head -n 4`; do echo "${a} | font=monospace | size=8 | trim=false"; done;
echo "------"
echo "<span size=\"large\" font_weight=\"bold\">Core speeds</span>"
LINE=`for a in /sys/devices/system/cpu/cpufreq/policy*; do echo -n "$(($(<$a/scaling_cur_freq)/1000))/$(($(<$a/scaling_max_freq)/1000)) :: "; done;`
echo "${LINE%::*}| font=monospace | size=8"
echo "------"
echo "<span size=\"large\" font_weight=\"bold\">Temperature</span>"
LINE=$(for current_node in `find /sys/devices -ipath '*hwmon*' -name 'temp*input'`; \
do \
input_temp=`<$current_node`; \
if [ "$input_temp" -eq "$input_temp" ] 2> /dev/null; \
then
input_name=`<${current_node%/*}/name`; \
[ -n "$input_name" ] && echo -n "$input_name "; \
echo -n "$(($input_temp / 1000))"; \
input_crit=`cat ${current_node%input}crit 2> /dev/null`; \
[ "$input_crit" -eq "$input_crit" ] 2> /dev/null && echo -n "/$(($input_crit / 1000))"; \
echo -n " :: "; \
fi; \
done)
echo "${LINE%::*} | font=monospace | size=8"
echo "------"
echo "<span size=\"large\" font_weight=\"bold\">top</span>"
( \
export LANG=C; \
for a in `top -o TIME -bcn1 -w150 | grep -vi "\b[KkMmGg]ib\b" | head -n 10`; do echo "${a} | font=monospace | size=8 | trim=false"; done; \
)
echo "------"
echo "<span size=\"large\" font_weight=\"bold\">dmesg</span>"
for a in `dmesg --color=always -Tx | fold -w 160 -s - | tail -n 10`; do echo "${a} | font=monospace | size=8"; done;
#df -h | sort -n --reverse -k 5,5