random script dump
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compton_toggle 426B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/zsh
  2. nvidia_dev='/dev/nvidia0'
  3. pidfile='/tmp/compton.pid'
  4. if [[ -r $pidfile ]]; then
  5. read pid < $pidfile
  6. rm $pidfile
  7. if kill $pid; then
  8. exit 0
  9. fi
  10. fi
  11. if [[ -e $nvidia_dev ]]; then
  12. gpu_opts=
  13. else
  14. gpu_opts=(--dbe --vsync opengl --backend xrender)
  15. fi
  16. compton $gpu_opts[@] -cGC -t-5 -l-5 -r4 -o.55 --no-fading-openclose &
  17. pid=$!
  18. if [[ -n $pid ]]; then
  19. printf '%s' $pid > $pidfile
  20. else
  21. exit 1
  22. fi
  23. disown
  24. exit 0