summaryrefslogtreecommitdiff
path: root/config/picom/shaders/shiny.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'config/picom/shaders/shiny.glsl')
-rw-r--r--config/picom/shaders/shiny.glsl33
1 files changed, 33 insertions, 0 deletions
diff --git a/config/picom/shaders/shiny.glsl b/config/picom/shaders/shiny.glsl
new file mode 100644
index 0000000..16636ac
--- /dev/null
+++ b/config/picom/shaders/shiny.glsl
@@ -0,0 +1,33 @@
+#version 430
+
+// Source: https://github.com/yshui/picom/issues/295#issuecomment-592077997
+
+in vec2 texcoord;
+
+uniform float opacity;
+uniform bool invert_color;
+uniform sampler2D tex;
+uniform float time;
+
+ivec2 window_size = textureSize(tex, 0);
+
+float amt = 10000.0;
+
+vec4 default_post_processing(vec4 c);
+
+vec4 window_shader() {
+ float pct = mod(time, amt) / amt * 1000;
+ float factor = float(max(window_size.x, window_size.y));
+ pct *= factor / 150.0;
+ vec2 pos = texcoord;
+ vec4 c = texelFetch(tex, ivec2(texcoord), 0);
+
+ if (pos.x + pos.y < pct * 4.0 && pos.x + pos.y > pct * 4.0 - .5 * pct
+ || pos.x + pos.y < pct * 4.0 - .8 * pct && pos.x + pos.y > pct * 3.0)
+ c *= vec4(2, 2, 2, 1);
+ if (invert_color)
+ c = vec4(vec3(c.a, c.a, c.a) - vec3(c), c.a);
+
+ c *= opacity;
+ return default_post_processing(c);
+}