Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Dimming unselected region. #169

Open
Momijie opened this issue Jul 8, 2023 · 1 comment
Open

Feature Request: Dimming unselected region. #169

Momijie opened this issue Jul 8, 2023 · 1 comment

Comments

@Momijie
Copy link

Momijie commented Jul 8, 2023

Could we dim the unselected regions for slop? Most selection tools use that to make it clear what's being selected and what isn't.
Any interest in adding a feature like this to the project, if so what would be a good approach, I'm interested in getting something like this implemented to greater standardize the user experience of selection on my system.

If an example is needed, think of the selection process of flameshot.

@HumanoidSandvichDispenser
Copy link

HumanoidSandvichDispenser commented Feb 9, 2024

Here's a glsl fragment shader that dims the unselected region

#version 120

uniform sampler2D texture;
uniform sampler2D desktop;

varying vec2 uvCoord;

void main()
{
    vec2 uv = vec2(uvCoord.x, -uvCoord.y);
    vec4 color = texture2D(desktop, uv);
    vec4 rect = texture2D(texture, uvCoord);
    gl_FragColor = vec4(vec3(0.0), color.a * 0.5) * (1.0 - rect);
}

Run slop with -l so it doesn't dim inside of the rectangle

There's also a shader that does the same thing but can also draw selection borders by calculating the size of a pixel in UV coordinates: #146 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants