From 486122ce5d1dac42fe56f9b16e14f8e382706659 Mon Sep 17 00:00:00 2001 From: Uwe Werler Date: Wed, 16 Sep 2020 19:18:07 +0000 Subject: [PATCH] add middled temp over all sensors --- .conkyrc | 6 ++++-- bin/conky_temp.sh | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 bin/conky_temp.sh diff --git a/.conkyrc b/.conkyrc index f7b2f21..2e4c25f 100644 --- a/.conkyrc +++ b/.conkyrc @@ -43,6 +43,7 @@ show_graph_range true lua_load ~/bin/conky_format.lua TEXT +${lua_parse format %2.2s ${execi 10 conky_temp.sh}}°C | \ CPU: ${lua_parse format %4.4s ${freq}} MHz \ ${lua_parse format %3.3s ${cpu cpu0}}% \ ${if_match ${cpu cpu0}>90}${color red}${else}\ @@ -56,5 +57,6 @@ WIFI: ${lua_parse format %3.3s ${execi 10 conky_wifi.sh sig}}% ${execibar 10 con ▲ ${upspeed iwm0} ▼ ${downspeed iwm0} \ ${if_empty ${addr iwm0}}${lua_parse format %15.15s 0.0.0.0}${endif}${lua_parse format %15.15s ${addr iwm0}} : \ ${execi 10 conky_wifi.sh sid} \ -$alignr Mails: ${new_mails $HOME/.local/share/mail/werler_is/INBOX 5} \ -$alignr ${time %a %d. %b %Y %H:%M:%S}${font}${offset 1920} +$alignr \ +Mails: ${new_mails $HOME/.local/share/mail/werler_is/INBOX 5} \ +${time %a %d. %b %Y %H:%M:%S}${font}${offset 1920} diff --git a/bin/conky_temp.sh b/bin/conky_temp.sh new file mode 100755 index 0000000..00e7fcd --- /dev/null +++ b/bin/conky_temp.sh @@ -0,0 +1,22 @@ +#!/bin/ksh + +_count=0 +_temp=0 + +sysctl hw.sensors | { while read _sensor _rest; do + + case ${_sensor} in + + *temp*) + + _t=${_sensor##*=} + _t=${_t%%.*} + + (( _count += 1 )) + (( _temp += ${_t} )) + ;; + esac + + done + [[ ${_count} -ne 0 ]] && print $(( _temp /= ${_count} )) +}