Your keyboard is the KVM switch.
A macOS menu bar app that switches your monitor’s input when your Bluetooth keyboard connects or disconnects. One monitor, two machines, no reaching for the buttons on the bezel.