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.

23 lines
667B

  1. #!/usr/bin/env bash
  2. PICOM_OPTIONS="--backend glx"
  3. # pgrep returns 0 if a matching process is found, 1 if not.
  4. # Thus 1 means there is either a picom process without b/w filter running,
  5. # or none at all. Either way, display is coloured when return code is 1.
  6. pgrep -fa gl_FragColor &>/dev/null
  7. if [ $? -eq 1 ];
  8. then
  9. pkill picom
  10. picom ${PICOM_OPTIONS} --glx-fshader-win \
  11. "uniform sampler2D tex;
  12. uniform float opacity;
  13. void main() {
  14. vec4 color = texture2D(tex, gl_TexCoord[0].xy);
  15. gl_FragColor = vec4(vec3(0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b) * opacity, color.a * opacity);
  16. }" &
  17. else
  18. pkill picom
  19. picom ${PICOM_OPTIONS} &
  20. fi