xcomp 948 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. #
  3. # Start a composition manager.
  4. # (picom, xcompmgr or compton)
  5. compmgr=picom
  6. comphelp() {
  7. echo "Composition Manager:"
  8. echo " (re)start: COMP"
  9. echo " toggle: COMP -t"
  10. echo " stop: COMP -s"
  11. echo " query: COMP -q"
  12. echo " returns if composition manager is running"
  13. exit
  14. }
  15. checkcomp() {
  16. pgrep $compmgr &>/dev/null
  17. }
  18. statuscomp() {
  19. if checkcomp; then
  20. echo "$compmgr is runing"
  21. else
  22. echo "$compmgr is stoped"
  23. fi
  24. exit 0
  25. }
  26. stopcomp() {
  27. checkcomp && killall $compmgr
  28. }
  29. startcomp() {
  30. stopcomp
  31. $compmgr &
  32. exit 0
  33. }
  34. togglecomp() {
  35. if checkcomp; then
  36. echo "Turning $compmgr OFF"
  37. stopcomp
  38. else
  39. echo "Turning $compmgr ON"
  40. startcomp
  41. fi
  42. exit 0
  43. }
  44. case "$1" in
  45. "") startcomp ;;
  46. "-q") statuscomp ;;
  47. "-s") stopcomp; exit ;;
  48. "-t") togglecomp ;;
  49. *) comphelp ;;
  50. esac