- Most monitors have multiple digital inputs. Connect each computer to one of them
- Use a USB switch keyboard and mouse
- Before switching the USB switch, press the "lock screen" key combination and make sure locking the screen drops the video signal
- After switching the USB switch, pressing shift should bring up the login dialog and re-activate video output. Since the monitor has just lost the signal in the previous step, it will scan the inputs and switch to the desired signal.
Even more ideally, the display would also have a built-in Bluetooth controller that stays active regardless of the USB controller's attach state, such that Bluetooth peripherals could be paired to the display itself rather than to the OS (i.e. you'd manage the pairings through the OSD of the display); and then these devices would be presented through the display's USB controller as always-on direct-attached USB devices — much like VM hypervisors present host-attached Bluetooth HID devices to their VM guests. (As a side-benefit of that, as long as the computer's BIOS understood Thunderbolt well-enough to display anything during boot, then even Bluetooth peripherals would also work during boot.)
I have AirPods but will only pair them to my phone.