#!/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 vsync_backend= else vsync_backend=('--vsync' 'drm') fi 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 exit 0