vscripts/compton_toggle
2017-08-15 12:40:00 +03:00

26 lines
404 B
Bash
Executable file

#!/usr/bin/zsh
nvidia_dev='/dev/nvidia0'
pidfile='/tmp/compton.pid'
if [[ -r $pidfile ]]; then
read pid < $pidfile
rm $pidfile
if kill $pid; then
exit 0
fi
fi
if [[ -e $nvidia_dev ]]; then
gpu_opts=
else
gpu_opts=(--dbe --vsync opengl --backend xrender)
fi
compton $gpu_opts[@] -cGC -t-5 -l-5 -r4 -o.55 &
pid=$!
if [[ -n $pid ]]; then
printf '%s' $pid > $pidfile
else
exit 1
fi
disown
exit 0