Comments (2)
this is how far i have got:
#version 330
in vec2 texcoord; // texture coordinate of the fragment
uniform float opacity; // opacity of the window (0.0 - 1.0)
uniform float corner_radius; // corner radius of the window (pixels)
// doesn't work for me :(
uniform float border_width; // estimated border width of the window (pixels)
uniform sampler2D tex; // texture of the window
uniform float time; // time in milliseconds, counting from an unspecified starting point
// Define tweakable variables
vec4 activeBorder = vec4(0,0,1,0);
vec4 inactiveBorder = vec4(1,0,0,1); // not implemented
float borderWidth = 5;
float cornerRadius = corner_radius;
// Default window post-processing:
// 1) invert color
// 2) opacity / transparency
// 3) max-brightness clamping
// 4) rounded corners
vec4 default_post_processing(vec4 c);
// get window size
ivec2 window_size = textureSize(tex, 0);
// Define useful functios
bool corner(bool left, bool top, float cx, float cy) {
return (
((left && texcoord.x < cx) || (!left && texcoord.x > cx))
&& ((top && texcoord.y < cy) || (!top && texcoord.y > cy))
&& pow(cx-texcoord.x, 2)
+ pow(cy-texcoord.y, 2)
> pow(cornerRadius-borderWidth, 2)
);
}
// Default window shader:
// 1) fetch the specified pixel
// 2) apply default post-processing
vec4 window_shader() {
vec4 c = texelFetch(tex, ivec2(texcoord), 0);
if ( c.a == 1 && (
// borders
texcoord.x < borderWidth
|| texcoord.y < borderWidth
|| texcoord.x > window_size.x - borderWidth
|| texcoord.y > window_size.y - borderWidth
// rounded corners
|| corner(true, true, cornerRadius, cornerRadius)
|| corner(false, true, window_size.x-cornerRadius, cornerRadius)
|| corner(false, false, window_size.x-cornerRadius, window_size.y-cornerRadius)
|| corner(true, false, cornerRadius, window_size.y-cornerRadius)
)) c = activeBorder;
return default_post_processing(c);
}
from picom-shaders.
wait that's it, i don't need to differentiate between active and inactive windows, i can do that from within picom
from picom-shaders.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picom-shaders.