Scripts to set the DPI of a desktop automatically when switching monitors
This pair of scripts is useful in the following scenario:
You have a laptop that you sometimes connect to an external monitor, so you switch from laptop display only to external only. However, the DPI needs adjusting, for instance because the screens have very different sizes or resolutions.
I use this script under MATE with Ubuntu 20.04 (Xorg, not Wayland).
Comments and improvements welcome. Acknowledgments to various fora.