Title: Turn your Xorg in black and white
Author: Solène
Date: 15 May 2021
Tags: unix
Description: 

# Introduction

If for some reasons you want to turn you display in black and white
mode and you can't control this on your display (typically a laptop
display won't allow you to change this), there are solutions.

# Compositor way

The best way I found is to use a compositor, fortunately I'm already
using "picom" as a compositor along with fvwm2 because I found the
windows are getting drawn faster when I switch between desktop with the
compositor on.  You will want to run the compositor in your ~/.xsession
file before running your window manager.

The idea is to run picom with a shader that will turn the color into a
gray scale, restart picom with no parameter if you want to get colors
back.

```command line sample
picom -b --backend glx --glx-fshader-win  "uniform sampler2D tex; uniform float opacity; void main() { vec4 c = texture2D(tex, gl_TexCoord[0].xy); float y = dot(c.rgb, vec3(0.2126, 0.7152, 0.0722)); gl_FragColor = opacity*vec4(y, y, y, c.a); }"
```

It was surprisingly complicated to find how to do that.  I stumbled on
"toggle-monitor-grayscale" project on github which is a long script to
automate this depending on your graphic card, I only took the part I
needed for picom.
toggle-monitor-grayscale project on Github
# Conclusion

I have no idea why someone would like to turn the screen in black and
white, but I've been curious to see how it would look like and if it
would be nicer for the eyes, it's an interesting experience I have to
admit but I prefer to keep my colors.