~kris/dots

srice

srice/.config/picom/shaders/focus_mode.glsl -rw-r--r-- 856 bytes
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#version 330

/*
   Focus Mode — picom shader
   Clean monochrome for distraction-free work.
   BT.709 grayscale with subtle warm paper tint and contrast boost.
*/

in vec2 texcoord;
uniform sampler2D tex;
uniform float opacity;

vec4 default_post_processing(vec4 c);

vec4 window_shader() {
    vec2 texsize = textureSize(tex, 0);
    vec4 pixColor = texture2D(tex, texcoord / texsize, 0);

    // BT.709 luminance
    float gray = dot(pixColor.rgb, vec3(0.2126, 0.7152, 0.0722));

    // Contrast enhancement — keeps text crisp after desaturation
    gray = clamp((gray - 0.5) * 1.08 + 0.5, 0.0, 1.0);

    // Warm paper tint — subtle enough to not register as yellow
    vec3 color = vec3(gray) * vec3(1.03, 1.0, 0.94);

    vec4 result = vec4(clamp(color, 0.0, 1.0) * opacity, pixColor.a * opacity);
    return default_post_processing(result);
}