73Linux/data/conky/setconky

70 lines
1.9 KiB
Text
Raw Permalink Normal View History

2022-11-15 11:18:22 -06:00
CONFIG_DIR=$HOME/bin/conky
CONKY_TMP=/tmp/conky.txt
2023-11-29 17:26:04 -06:00
CPU=$(lscpu | grep "Vendor ID" | grep ARM)
2022-11-15 11:18:22 -06:00
if [ -z "$CPU" ]; then
CONFIG_FILES=${CONFIG_DIR}/*.86
2022-12-04 19:18:46 -06:00
TYPE=".86"
2022-11-15 11:18:22 -06:00
else
CONFIG_FILES=${CONFIG_DIR}/*.pi
2022-12-04 19:18:46 -06:00
TYPE=".pi"
2022-11-15 11:18:22 -06:00
fi
CALL=$(cat ~/.conkyrc | grep "{color Yellow}" | sed s'/.*{alignc}//' | head -1)
INFO=$(yad --form --width=420 --text-align=center --center --title="Conky Prefs" \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text="<b>Enter Your Call Sign</b>" \
--field="Call Sign" "$CALL" \
--button="Continue":2)
BUT=$?
if [ ${BUT} = 252 ]; then
exit
fi
CALL=$(echo ${INFO} | awk -F "|" '{print $1}')
for files in ${CONFIG_FILES}; do
2024-05-13 21:05:01 -07:00
echo -e "\n$files" | awk -F "/" '{print $NF}' | sed 's/'$TYPE'//'
2022-11-15 11:18:22 -06:00
done | yad --width=550 --height=400 --title="Conky Prefs" --image=$LOGO \
--center --list --print-all --checklist --grid-lines=hor \
--column="" --column="File Name" \
--text="Select ONE config to install." --button="Cancel":1 --button="Load Config":2 > $CONKY_TMP
CK=$(grep TRUE $CONKY_TMP)
if [ -z "$CK" ]; then
rm $CONKY_TMP
exit
fi
NEW_CONKY=$(grep TRUE $CONKY_TMP | awk -F "|" '{print $2}')
2022-12-04 19:18:46 -06:00
NEW_CONKY=${CONFIG_DIR}/${NEW_CONKY}${TYPE}
2022-11-15 11:18:22 -06:00
echo $NEW_CONKY
cp $NEW_CONKY $HOME/.conkyrc
WLAN=$(ifconfig | grep wl | awk '{print $1}' | sed 's/://')
sed -i "s/wlan0/$WLAN/" $HOME/.conkyrc
sed -i "s/N0CALL/${CALL}/" $HOME/.conkyrc
2024-07-30 14:59:31 -04:00
#Lines below are for https://github.com/km4ack/pi-build/issues/53
WINDOWMGMT=$(echo $XDG_SESSION_TYPE)
if [[ $WINDOWMGMT == "wayland" ]]; then
COUNTOUTX=$(grep -c 'out_to_x' $HOME/.conkyrc)
COUNTOUTWYLD=$(grep -c 'out_to_wayland' $HOME/.conkyrc)
if [[ $COUNTOUTX == 0 ]]; then
sed -i '/.*conky.config = {/a \\tout_to_x = false,' $HOME/.conkyrc
fi
if [[ $COUNTOUTWYLD == 0 ]]; then
sed -i '/.*out_to_x = .*/a \\tout_to_wayland = true,' $HOME/.conkyrc
fi
fi
2022-11-15 11:18:22 -06:00
CONKY_PID=$(pidof conky)
kill -9 $CONKY_PID
/usr/bin/conky
rm $CONKY_TMP