Good idea actually, I’m using 2 PCs with one monitor over USB-c. The monitor takes more than 10 key presses through a horrific on screen menu to change input sources. I didn’t even think of swapping the cable!
I can’t change the input from a pc, only using buttons on the monitor itself. Using i2c over display port is possible to change input source but I don’t really have the will to spend time on trying it.
Incidentally, I was asked to uninstall autohotkey from my work PC because some corporate spyware detected it as a threat.