I had the exact problem, and found and expensive but clean solution:
I bought a U2723QE Dell screen, acting as a Hub. All my devices and RJ45 are plugged to the screen.
My laptop uses the charging USB-C port. My desktop requires 2 cables: 1 DP cable (so I can chain another screen) and 1 usb-c cable to the usb-c upstream port.
Whenever I want to switch, I just need to change the input source on my screen, between DP (desktop) or USB-C (laptop). All USB devices and internet are automatically routed to the right computer.
It works like a charm, really happy with this (but once again, that's an expensive screen)
My laptop uses the charging USB-C port. My desktop requires 2 cables: 1 DP cable (so I can chain another screen) and 1 usb-c cable to the usb-c upstream port.
Whenever I want to switch, I just need to change the input source on my screen, between DP (desktop) or USB-C (laptop). All USB devices and internet are automatically routed to the right computer.
It works like a charm, really happy with this (but once again, that's an expensive screen)