diff --git a/comp.sh b/comp.sh deleted file mode 100755 index e247b26..0000000 --- a/comp.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/zsh -compton_lockfile=/tmp/compton.lock -if [[ -e ${compton_lockfile} ]]; then - kill $(pgrep compton) - rm ${compton_lockfile} -else - touch ${compton_lockfile} - compton --vsync drm --unredir-if-possible --paint-on-overlay -cGCb -t-5 -l-5 -r4 -o.55 -m.95 -fi -exit 0 diff --git a/compton_toggle b/compton_toggle new file mode 100755 index 0000000..15aa3be --- /dev/null +++ b/compton_toggle @@ -0,0 +1,20 @@ +#!/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