If you want a proper kvm, see the offering from level1techs/wendell (not affiliated, just a satisfied customer) at https://www.store.level1techs.com/products/hardware
I used one with 4x dual dp switching at home to run desktop with linux, pcie passthrough gaming vm on same machine and my work laptop via a dell thunderbolt dock connected to it.
Works extremely well, with modern features tested for (gsync, high refresh etc etc).
edit: one thing to note is that you need really good quality cables, so don't cheap out