Using Macbook and Windows Desktop with wired mouse and keyboard My Monitor has 1 spare HDMI port and the desktop it is connected to (through another HDMI) has wired mouse and keyboard attached to it.

I am looking for a device or cable that would allow me to plug in my 2017 MacBook Pro to the monitor and to use the existing mouse and keyboard without unplugging them from the desktop.

So far I have explored two options


Connect the Mac using a USB-C to HDMI cable to the monitor and use a software to redirect inputs from desktop. In this case I will have to keep my desktop running while I'm using the Mac which is what I don't want.
Use a device (example) to convert my mouse and keyboard to Bluetooth and connect them to both desktop and Mac (while using the same USB-C to HDMI cable to connect the MacBook to the monitor)


Are there, possibly, any other easy options?
You either need a KVM (Keyboard Video Mouse) switch  or a USB device switch.


A KVM will allow you to switch the keyboard, video and mouse between multiple computers; doing exactly what you describe without having to use the extra HDMI port on your monitor
A USB device sharing switch is a much cheaper alternative and will allow you to share USB peripherals between multiple computers and switch them by pressing a button.  With this option you will need the second HDMI input on your monitor. 


Your desktop computer won't have to be running with either solution.

As for converting your mouse/keyboard to Bluetooth, (IMO) it is a step in the wrong direction as it would probably be easier to just get a Bluetooth mouse/keyboard combo (i.e. Logitech) that supported multiple computers.