Created
February 20, 2022 17:03
-
-
Save nemolize/dca4793422caf95ce3f1af4f8380d1c2 to your computer and use it in GitHub Desktop.
Gray scale window fragment GLSL shader works with Picom compositor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* To get this shader working, Run picom like the following | |
picom --glx-fshader-win "$(cat ~/.config/picom/gs.glsl)" | |
NOTE: You need to set the backend to "glx" to get this working. | |
*/ | |
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment