Note the c code is taken from here and is not my own:[URL]
I was trying to come up with an easy way to use a keyboard shortcut to switch my monitor + KVM under Linux. This is what I ended up coming up with in case it helps anyone else. Monitor settings can be queried and changed using the `ddcutil` utility. This was in the main repositories for me. After installing =         I could then query my monitor settings (you may need to change the number at the end to match your monitor) =         Which gave me =         Using those values I could switch between my work and person laptop using =         This command can be used in a simple bash script, but I decided to make a executable so I could run it without sudo. The c code =         Compiling and setting the appropriate permissions (this could easy just be a Makefile) =           The resulting executable `switch_screen` can then be used by your favorite desktop shortcut manager. Tested under Debian (Gnome) and Ubuntu (KDE) on a Dell U2723QE monitor. ddcutil should also be available for Fedora+ and there exists an experimental GUI, see the above link, if you are more comfortable starting with that.
U2723QE, KVM using a keyboard shortcut to switch in Linux