toggle black/white filter with picom
This commit is contained in:
commit
e82682fd7a
1 changed files with 20 additions and 0 deletions
20
toggle-bw.sh
Executable file
20
toggle-bw.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# pgrep returns 0 if a matching process is found, 1 if not.
|
||||
# Thus 1 means there is either a picom process without b/w filter running,
|
||||
# or none at all. Either way, display is coloured when return code is 1.
|
||||
pgrep -fa gl_FragColor &>/dev/null
|
||||
if [ $? -eq 1 ];
|
||||
then
|
||||
pkill picom
|
||||
picom --backend glx --glx-fshader-win \
|
||||
"uniform sampler2D tex;
|
||||
uniform float opacity;
|
||||
void main() {
|
||||
vec4 color = texture2D(tex, gl_TexCoord[0].xy);
|
||||
gl_FragColor = vec4(vec3(0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b) * opacity, color.a * opacity);
|
||||
}" &
|
||||
else
|
||||
pkill picom
|
||||
picom &
|
||||
fi
|
Loading…
Reference in a new issue