I swear there was a HN post about someone who made a KVM alternative on this principal (pass KB/M through a microcontroller or something and have it act as downstream KB/M to multiple devices) but for the life of me I can't find it. That or I dreamed the whole thing up.
Are you thinking of the display-switch[0] script? Achieves K/V/M-switching with only a cheap USB-switch for hardware K/M-switching, and then this script detects such peripheral switching and emits DDC-commands for monitors to switch accordingly.
I saw it posted here on HN[1], and have been using it since then with great success.