picom greyscale

master
Daniel Napora 2021-10-23 14:34:29 +02:00
parent f727e2448e
commit 8e5f59af6e
1 changed files with 21 additions and 0 deletions

21
bin/greyscale 100755
View File

@ -0,0 +1,21 @@
#!/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;
}
"