It so happens that there is a software only way to do this.

I was watching LinusTechTips and they were advertising this software on their end of video sponsor.

The software is called [Synergy](https://symless.com/synergy).

It actually works by creating some sort of local network and communicating over your own computers, making the experience very, very fast. The benefits of this over a hardware KVM switch is that this is software (not hardware duh ;)) and it is priced as low as $19, depending on the option you pick.

[The $19 option](https://symless.com/synergy/pricing) would be perfectly suitable for your needs, other options are encryption over the network, and unless your network is already insecure, you dont really need it.

As per a concern below, it runs on both wireless and wired connections!

Hope this is a suitable suggestion for you.