vscripts/compton_toggle
2015-06-22 22:18:31 +03:00

20 lines
434 B
Bash
Executable file

#!/usr/bin/zsh
nvidia_dev='/dev/nvidia0'
lockfile='/tmp/compton.lock'
if [[ -r $lockfile ]]; then
read pid < $lockfile
kill $pid
rm $lockfile
else
if [[ -e $nvidia_dev ]]; then
vsync_backend='opengl'
else
vsync_backend='drm'
fi
compton --vsync $vsync_backend --unredir-if-possible --paint-on-overlay -cGCb -t-5 -l-5 -r4 -o.55 -m.95
pid=$(pidof compton)
if [[ -n $pid ]]; then
printf '%s' $pid > $lockfile
fi
fi
exit 0