diff options
Diffstat (limited to 'config/picom')
| -rw-r--r-- | config/picom/picom.conf | 19 | ||||
| -rw-r--r-- | config/picom/shaders/bg.glsl | 138 | ||||
| -rw-r--r-- | config/picom/shaders/glitch.glsl | 9 | ||||
| -rw-r--r-- | config/picom/shaders/glitch_animation.glsl | 19 |
4 files changed, 161 insertions, 24 deletions
diff --git a/config/picom/picom.conf b/config/picom/picom.conf index d30d4eb..fbe89c1 100644 --- a/config/picom/picom.conf +++ b/config/picom/picom.conf @@ -55,10 +55,10 @@ shadow-offset-y = -7; fading = true; # Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) -fade-in-step = 0.01; +fade-in-step = 0.012; # Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) -fade-out-step = 0.01; +fade-out-step = 0.012; # The time between steps in fade step, in milliseconds. (> 0, defaults to 10) fade-delta = 2 @@ -94,7 +94,7 @@ frame-opacity = 0.7; # `transparent-clipping`. # # Default: 0 (disabled) -corner-radius = 0 +corner-radius = 5 ################################# # Blur # @@ -229,7 +229,7 @@ use-damage = false; # # Can be set per-window using rules. # -window-shader-fg = "~/.config/picom/shaders/glitch_animation.glsl" +#window-shader-fg = "~/.config/picom/shaders/glitch_animation.glsl" # Force all windows to be painted with blending. Useful if you # have a `window-shader-fg` that could turn opaque pixels transparent. @@ -295,7 +295,6 @@ rules: ({ blur-background = false; }, { match = "window_type != 'dock'"; - # shader = "my_shader.frag"; }, { match = "window_type = 'dock' || " "window_type = 'desktop'"; @@ -307,7 +306,15 @@ rules: ({ "class_g = 'Cairo-clock' || " "_GTK_FRAME_EXTENTS@"; shadow = false; -}) +}, +{ + match = "window_type = 'desktop'"; + shader = "/home/x/.config/picom/shaders/glitch.glsl"; +}, +{ + match = "window_type != 'desktop'"; + shader = "/home/x/.config/picom/shaders/glitch_animation.glsl"; +}); # `@include` directive can be used to include additional configuration files. # Relative paths are search either in the parent of this configuration file diff --git a/config/picom/shaders/bg.glsl b/config/picom/shaders/bg.glsl new file mode 100644 index 0000000..e15c18d --- /dev/null +++ b/config/picom/shaders/bg.glsl @@ -0,0 +1,138 @@ +#version 330 + +int delta = 20; +float barh = 0.05; +float barw = 0.6; +int nbar = 8; + +float maxoff = 32; +float minoff = 2; +float hue = 0.3; + +// blinds +int blinds_spacing = 4; +int blinds_width = 1; +float blinds_intensity = 1.2; + +in vec2 texcoord; // texture coordinate of the fragment + +uniform sampler2D tex; // texture of the window +ivec2 window_size = textureSize(tex, 0); +ivec2 window_center = ivec2(window_size.x/2, window_size.y/2); + +// Default window post-processing: +// 1) invert color +// 2) opacity / transparency +// 3) max-brightness clamping +// 4) rounded corners +vec4 default_post_processing(vec4 c); + +uniform float time; // Time in miliseconds. + +float alpha = round(time/delta); // Like time, but in seconds and resets to + +vec4 blinds(vec4 c, vec2 coords) { + if (mod(coords.y, blinds_spacing) < blinds_width) { + return c * blinds_intensity; + } + + return c; +} + +vec3 hueShift( vec3 color, float hueAdjust ){ + + const vec3 kRGBToYPrime = vec3 (0.299, 0.587, 0.114); + const vec3 kRGBToI = vec3 (0.596, -0.275, -0.321); + const vec3 kRGBToQ = vec3 (0.212, -0.523, 0.311); + + const vec3 kYIQToR = vec3 (1.0, 0.956, 0.621); + const vec3 kYIQToG = vec3 (1.0, -0.272, -0.647); + const vec3 kYIQToB = vec3 (1.0, -1.107, 1.704); + + float YPrime = dot (color, kRGBToYPrime); + float I = dot (color, kRGBToI); + float Q = dot (color, kRGBToQ); + float hue = atan (Q, I); + float chroma = sqrt (I * I + Q * Q); + + hue += hueAdjust; + + Q = chroma * sin (hue); + I = chroma * cos (hue); + + vec3 yIQ = vec3 (YPrime, I, Q); + + return vec3( dot (yIQ, kYIQToR), dot (yIQ, kYIQToG), dot (yIQ, kYIQToB) ); + +} + +// Pseudo-random function (from original shader) +float random(float n) { + return fract(sin(n) * 43758.5453f); +} + +float get_box() { + float n = random(alpha)*(nbar); + + for(int i=0;i<n;i++){ + float y = random(mod(alpha, 2048)+i) * window_size.y; + float x = random(mod(alpha+128, 2048)+i) * window_size.x; + float w = random(mod(alpha+64, 2048)+i) * barw*window_size.x; + float h = random(mod(alpha+32, 2048)+i) * barh*window_size.y; + if (texcoord.y > y && texcoord.y < y + h + && texcoord.x > x && texcoord.x < x + w) { + return i*w*h*y*x*n; + } + } + return -1.0f; +} + +float rand_offset(float b) { + return (random(b*64) - 0.5) * (maxoff*2); +} + +vec4 window_color(vec2 uv) { + return blinds(texelFetch(tex, ivec2(uv), 0), uv); +} + +vec4 window_shader() { + float b = get_box(); + + if (b == -1.0) { + vec4 c = window_color(ivec2(texcoord)); + return default_post_processing(c); + } + //b = random(mod(alpha, 2000)); + + // Offsets in pixels for each color + vec2 uvr = vec2(rand_offset(b*1), rand_offset(b*6)); + vec2 uvg = vec2(rand_offset(b*2),rand_offset(b*7)); + vec2 uvb = vec2(rand_offset(b*3),rand_offset(b*8)); + + + // Calculate offset coords + uvr += texcoord; + uvg += texcoord; + uvb += texcoord; + + // Fetch colors using offset coords + vec3 offset_color; + offset_color.x = window_color(uvr).x; + offset_color.y = window_color(uvg).y; + offset_color.z = window_color(uvb).z; + + offset_color.x = hueShift(window_color(uvr).xyz, hue).x; + offset_color.y = hueShift(window_color(uvg).xyz, hue).y; + offset_color.z = hueShift(window_color(uvb).xyz, hue).z; + + offset_color.xyz = hueShift(offset_color.xyz, -hue); + // Set the new color + vec4 c; + c.w = texelFetch(tex, ivec2(uvr), 0).w; + c.xyz = offset_color; + + c.xyz = hueShift(c.xyz, random(mod(b, 2000))); + + return default_post_processing(c); +} + diff --git a/config/picom/shaders/glitch.glsl b/config/picom/shaders/glitch.glsl index be28f78..aa27fe6 100644 --- a/config/picom/shaders/glitch.glsl +++ b/config/picom/shaders/glitch.glsl @@ -1,12 +1,11 @@ #version 330 - int delta = 20; -float barh = 0.02; -float barw = 0.4; -int nbar = 16; +float barh = 0.05; +float barw = 0.6; +int nbar = 8; -float maxoff = 5; +float maxoff = 32; float minoff = 2; in vec2 texcoord; // texture coordinate of the fragment diff --git a/config/picom/shaders/glitch_animation.glsl b/config/picom/shaders/glitch_animation.glsl index be1e16c..ee2ae8f 100644 --- a/config/picom/shaders/glitch_animation.glsl +++ b/config/picom/shaders/glitch_animation.glsl @@ -1,7 +1,7 @@ #version 330 float maxoff = 10; -float minoff = 2; +float minoff = 0; float hue = 0.3; float block_max = 500; @@ -18,12 +18,9 @@ float max_opacity = 0.9; float opacity_threshold(float opacity) { // if statement jic? - if (opacity >= max_opacity) - { + if (opacity >= max_opacity) { return 1.0; - } - else - { + } else { return min(1, opacity/max_opacity); } @@ -96,24 +93,20 @@ vec4 anim(float alpha) { offset_color.z = hueShift(texelFetch(tex, ivec2(uvb), 0).xyz, hue).z; offset_color.xyz = hueShift(offset_color.xyz, -hue); - + // Set the new color vec4 c; c.w = texelFetch(tex, ivec2(uvr), 0).w; c.xyz = offset_color; - return default_post_processing(c); + return c; } vec4 window_shader() { vec4 c = texelFetch(tex, ivec2(texcoord), 0); c = default_post_processing(c); float opacity = opacity_threshold(c.w); - if (opacity != 1.0) - { - c = anim(opacity); - } - //c = anim(opacity); + c = anim(opacity); return default_post_processing(c); } |
