vscripts/compton_toggle

27 lines
401 B
Text
Raw Normal View History

2015-06-22 22:18:31 +03:00
#!/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
2015-06-22 22:18:31 +03:00
fi
fi
if [[ -e $nvidia_dev ]]; then
2015-06-27 17:53:23 +03:00
vsync_backend=
else
2015-06-27 17:53:23 +03:00
vsync_backend=('--vsync' 'drm')
fi
2015-06-27 17:53:23 +03:00
compton $vsync_backend[@] -cGC -t-5 -l-5 -r4 -o.55 -m.9 &
pid=$!
if [[ -n $pid ]]; then
printf '%s' $pid > $pidfile
else
exit 1
fi
disown
2015-06-22 22:18:31 +03:00
exit 0