pi-build/conky/setconky

67 wiersze
2.0 KiB
Plaintext
Czysty Zwykły widok Historia

2020-01-23 16:35:49 +00:00
#!/bin/bash
2020-06-14 14:06:24 +00:00
#set conky display size &/or update call sign
2020-01-23 16:35:49 +00:00
#20200123 km4ack
2020-06-14 14:06:24 +00:00
#20200514 edit km4ack
2020-01-23 16:35:49 +00:00
2020-06-14 14:06:24 +00:00
MYPATH=$HOME/pi-build/conky
TEMPFILE=/run/user/1000/conky.tmp
CALL=$(cat ~/.conkyrc | grep "{color Yellow}" | sed s'/.*{alignc}//' | head -1)
INFO=$(yad --form --width=420 --text-align=center --center --title="Preferences" \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="<b>Conky Preferences</b>\r\rThis only changes the call sign in conky." \
--field="Call Sign" "$CALL" \
--field="Conky Size":CB "conky-small|conky-medium|conky-large" \
--field="C or F":CB "C|F" \
--button="Exit":1 \
--button="Continue":2)
BUT=$?
if [ $BUT = 252 ] || [ $BUT = 1 ]; then
exit
2020-01-23 16:35:49 +00:00
fi
2020-06-14 14:06:24 +00:00
CALL=$(echo $INFO | awk -F "|" '{ print $1 }')
CALL=${CALL^^}
CS=$(echo $INFO | awk -F "|" '{ print $2 }')
TEMP=$(echo $INFO | awk -F "|" '{ print $3 }')
2020-01-23 16:35:49 +00:00
2020-06-14 14:06:24 +00:00
cp $MYPATH/$CS $TEMPFILE
2020-02-14 13:08:09 +00:00
2020-06-14 14:06:24 +00:00
sed -i "s/N0CALL/$CALL/" $TEMPFILE
if [ "$TEMP" = 'C' ] && [ "$CS" = 'conky-large' ]; then
#delete F line
echo
sed -i '/vcgencmd/d' $TEMPFILE
#add cel line
sed -i '/#TEMP/a \
${font Arial:bold:size=14}${color White}Temp: $alignr ${exec /opt/vc/bin/vcgencmd measure_temp | cut -c6-9} C' $TEMPFILE
elif [ "$TEMP" = 'C' ] && [ "$CS" = 'conky-medium' ]; then
#delete F line
echo
sed -i '/vcgencmd/d' $TEMPFILE
#add cel line
sed -i '/#TEMP/a \
${font Arial:bold:size=10}${color White}Temp: $alignr ${exec /opt/vc/bin/vcgencmd measure_temp | cut -c6-9} C' $TEMPFILE
elif [ "$TEMP" = 'C' ] && [ "$CS" = 'conky-small' ]; then
#delete F line
echo
sed -i '/vcgencmd/d' $TEMPFILE
#add cel line
sed -i '/#TEMP/a \
${font Arial:bold:size=08}${color White}Temp: $alignr ${exec /opt/vc/bin/vcgencmd measure_temp | cut -c6-9} C' $TEMPFILE
fi
cp $TEMPFILE $HOME/.conkyrc
2020-02-14 13:08:09 +00:00
sudo killall conky > /dev/null 2>&1
2020-06-14 14:06:24 +00:00
conky > /dev/null 2>&1
yad --form --width=420 --text-align=center --center --title="Preferences" \
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
--text="<b>Conky Preferences</b>\r\rConky is being restarted" \
--button=gtk-ok