upload
This commit is contained in:
53
bin/conky_toggle
Executable file
53
bin/conky_toggle
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
toggle(){
|
||||
if pgrep -u $USER -f "conky -c" ;then
|
||||
pkill -9 -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
|
||||
}
|
||||
|
||||
start_conky(){
|
||||
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
|
||||
}
|
||||
|
||||
stop_conky(){
|
||||
if pgrep -u $USER -f "conky -c" ;then
|
||||
pkill -9 -u $USER conky
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start) start_conky;;
|
||||
stop) stop_conky;;
|
||||
*) toggle;;
|
||||
esac
|
||||
Reference in New Issue
Block a user