mabox-tools/bin/conky_toggle
2023-08-19 16:23:51 +02:00

22 lines
483 B
Bash
Executable File

#!/bin/bash
if pgrep -u $USER -f "conky -c" ;then
pkill -u $USER conky
else
SESSIONFILE=$HOME/.config/conky/conky-sessionfile
while read -r line; do
if [[ $line == *conky* ]]; then
THIS_CONKY=$(echo "${line##+([[:space:]])}" | awk '{print $3}')
CONKYRC=${THIS_CONKY//\'/}
if ! pgrep -u $USER -f "${CONKYRC//\~/}"
then
conky -c "${CONKYRC//\~/$HOME}" &
else
pkill -u $USER -f "${CONKYRC//\~/}"
fi
fi
done < $SESSIONFILE
fi
exit 0