mabox-tools/bin/conky_toggle

22 lines
483 B
Plaintext
Raw Permalink Normal View History

2021-05-28 02:57:30 +02:00
#!/bin/bash
2023-08-19 16:23:51 +02:00
if pgrep -u $USER -f "conky -c" ;then
pkill -u $USER conky
2022-06-03 02:25:45 +02:00
else
2021-05-28 02:57:30 +02:00
SESSIONFILE=$HOME/.config/conky/conky-sessionfile
while read -r line; do
2021-06-01 17:36:15 +02:00
if [[ $line == *conky* ]]; then
2021-06-01 16:48:57 +02:00
THIS_CONKY=$(echo "${line##+([[:space:]])}" | awk '{print $3}')
2021-05-28 02:57:30 +02:00
CONKYRC=${THIS_CONKY//\'/}
2023-08-19 16:23:51 +02:00
if ! pgrep -u $USER -f "${CONKYRC//\~/}"
2021-05-28 02:57:30 +02:00
then
conky -c "${CONKYRC//\~/$HOME}" &
else
2023-08-19 16:23:51 +02:00
pkill -u $USER -f "${CONKYRC//\~/}"
2021-05-28 02:57:30 +02:00
fi
2021-06-01 17:36:15 +02:00
fi
2021-05-28 02:57:30 +02:00
done < $SESSIONFILE
2022-06-03 02:25:45 +02:00
fi
2021-05-28 02:57:30 +02:00
exit 0