mabox-tools/bin/greyscale

22 lines
587 B
Plaintext
Raw Normal View History

2021-10-23 14:34:29 +02:00
#!/usr/bin/env bash
#
# Grayscale using picom.
# Based on https://wiki.archlinux.org/title/Picom#Grayscale
killall picom
picom --backend glx --glx-fshader-win "
uniform float opacity;
uniform bool invert_color;
uniform sampler2D tex;
void main() {
vec4 c = texture2D(tex, gl_TexCoord[0].xy);
float g = (c.r + c.g + c.b) / 3.0; // EDIT1: Average.
c = vec4(vec3(g), c.a); // EDIT2: Color.
if (invert_color)
c = vec4(vec3(c.a, c.a, c.a) - vec3(c), c.a);
c *= opacity;
gl_FragColor = c;
}
"