move formatting logic to the scripts itself to avoid execution on every update interval - reduces cpu time of conly massively

This commit is contained in:
Alcali 2020-09-17 10:38:48 +00:00
parent 486122ce5d
commit b07a6394b1
3 changed files with 19 additions and 13 deletions

View File

@ -14,8 +14,8 @@ own_window_hints skip_taskbar,skip_pager,undecorated,below,sticky
own_window_colour 000000 own_window_colour 000000
own_window_class Conky own_window_class Conky
own_window_title mangstadt mangstadt test conky own_window_title mangstadt mangstadt test conky
minimum_size 1920 minimum_size 1800
maximum_width 1920 maximum_width 1800
default_bar_size 50 10 default_bar_size 50 10
double_buffer yes double_buffer yes
@ -43,7 +43,7 @@ show_graph_range true
lua_load ~/bin/conky_format.lua lua_load ~/bin/conky_format.lua
TEXT TEXT
${lua_parse format %2.2s ${execi 10 conky_temp.sh}}°C | \ ${execi 30 conky_temp.sh}°C | \
CPU: ${lua_parse format %4.4s ${freq}} MHz \ CPU: ${lua_parse format %4.4s ${freq}} MHz \
${lua_parse format %3.3s ${cpu cpu0}}% \ ${lua_parse format %3.3s ${cpu cpu0}}% \
${if_match ${cpu cpu0}>90}${color red}${else}\ ${if_match ${cpu cpu0}>90}${color red}${else}\
@ -52,11 +52,11 @@ ${cpubar cpu0 10,50}${color} \
RAM: ${lua_parse format %4.4s ${memperc}}% \ RAM: ${lua_parse format %4.4s ${memperc}}% \
${membar 10,50} \ ${membar 10,50} \
BAT: ${lua_parse format %4.4s ${apm_battery_life}} \ BAT: ${lua_parse format %4.4s ${apm_battery_life}} \
${if_match ${execi 10 apm -l}<10}${color red}${else}${if_match ${execi 10 apm -l}<50}${color yellow}${endif}${endif}${execibar 10 apm -l}$color \ ${if_match ${execi 30 apm -l}<10}${color red}${else}${if_match ${execi 30 apm -l}<50}${color yellow}${endif}${endif}${execibar 30 apm -l}${color grey} \
WIFI: ${lua_parse format %3.3s ${execi 10 conky_wifi.sh sig}}% ${execibar 10 conky_wifi.sh sig} \ WIFI: ${execi 10 conky_wifi.sh sig}% ${execibar 10 conky_wifi.sh sig} \
▲ ${upspeed iwm0} ▼ ${downspeed iwm0} \ ▲ ${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}} : \ ${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} \ ${execi 60 conky_wifi.sh sid} \
$alignr \ $alignr \
Mails: ${new_mails $HOME/.local/share/mail/werler_is/INBOX 5} \ Mails: ${new_mails $HOME/.local/share/mail/werler_is/INBOX 60} \
${time %a %d. %b %Y %H:%M:%S}${font}${offset 1920} ${time %a %d. %b %Y %H:%M:%S}${font}${offset 1920}

View File

@ -18,5 +18,5 @@ sysctl hw.sensors | { while read _sensor _rest; do
esac esac
done done
[[ ${_count} -ne 0 ]] && print $(( _temp /= ${_count} )) [[ ${_count} -ne 0 ]] && printf "%2.2s" $(( _temp /= ${_count} ))
} }

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
_sep=":" _sep=':'
ifconfig wlan | { while read _line; do ifconfig wlan | { while read _line; do
@ -34,15 +34,21 @@ ifconfig wlan | { while read _line; do
case ${_arg} in case ${_arg} in
sig) sig)
set -A WIFI ${WIFI[*]} ${WIFI:+${_sep}} ${_sig} printf "%s" ${_count:+\ ${_sep}\ }
printf "%3.3s" ${_sig}
[[ ${#@} -gt 1 ]] && printf "%s" "%"
_count=1
;; ;;
sid) sid)
set -A WIFI ${WIFI[*]} ${WIFI:+${_sep}} ${_sid} printf "%s" ${_count:+\ ${_sep}\ }
printf "%s" ${_sid}
_count=1
;; ;;
ip) ip)
set -A WIFI ${WIFI[*]} ${WIFI:+${_sep}} ${_ip} printf "%s" ${_count:+\ ${_sep}\ }
printf "%s" ${_ip}
_count=1
;; ;;
esac esac
done done
print ${WIFI[*]}
} }