#version 330 // ── Gradient border shader for picom ───────────────────────────────────────── // Blends a diagonal gradient (top-left → bottom-right) over the window border. // // COLOR_A : top-left colour — #7B2FBE (purple) // COLOR_B : bottom-right — #2FB8BE (teal) // // To change colours: convert hex → float by dividing each channel by 255. // ── Tuneable constants ──────────────────────────────────────────────────────── const float BORDER_WIDTH = 4.0; // Border band thickness in pixels const float BORDER_OPACITY = 0.95; // How strongly the gradient is applied // COLOR_A: #7B2FBE (vibrant purple) const vec3 COLOR_A = vec3(0.106, 0.992, 0.612); // COLOR_B: #2FB8BE (cyan-teal) const vec3 COLOR_B = vec3(0.651, 1.0, 0.788); // ── Picom-provided ──────────────────────────────────────────────────────────── in vec2 texcoord; // Fragment texture coordinate (in pixels) uniform sampler2D tex; // Window texture // Picom's built-in post-processing (opacity, rounded corners, etc.) vec4 default_post_processing(vec4 c); // ── Entry point ─────────────────────────────────────────────────────────────── vec4 window_shader() { // Sample the original window pixel vec4 c = texelFetch(tex, ivec2(texcoord), 0); // Derive texture size from the sampler vec2 size = vec2(textureSize(tex, 0)); // Normalised UV (0,0) top-left → (1,1) bottom-right vec2 uv = texcoord / size; // Diagonal gradient factor float t = (uv.x + uv.y) * 0.5; vec3 gradient = mix(COLOR_A, COLOR_B, t); // Border mask: 1.0 on the edge band, 0.0 in the interior float left = smoothstep(0.0, BORDER_WIDTH, texcoord.x); float right = smoothstep(0.0, BORDER_WIDTH, size.x - texcoord.x); float top = smoothstep(0.0, BORDER_WIDTH, texcoord.y); float bottom = smoothstep(0.0, BORDER_WIDTH, size.y - texcoord.y); float mask = 1.0 - (left * right * top * bottom); // Blend gradient onto border region only c.rgb = mix(c.rgb, gradient, mask * BORDER_OPACITY); // Let picom handle opacity, rounded corners, etc. return default_post_processing(c); }