Prevent MacBook Pro (clamshell mode) from sleeping when KVM switches to a different computer

I have a setup of a Mac Mini and a MacBook Pro connected to a KVM switch that allows me to share my monitors, mouse and keyboard between both of them by pushing a single button.

When I switch to the MacBook Pro, the Mac mini stays put. When I switch back I see my desktops or maybe the screensaver.

When I switch to the Mac mini, the MacBook Pro immediately goes to sleep. When I switch back I have to wake it up (takes a while).

My guess is that this is happening because since the KVM is showing the contents of the Mac mini to the monitors, the MacBook Pro is kinda like if it's closed with no monitor attached.

How can I prevent it from going to sleep?


Solution 1:

Use Amphetamine and remember to uncheck the "allow system sleep when display is closed" option.

Solution 2:

The issues are caused by the KVM switch does not provide full-time EDID emulation/feeding to all connected systems (both your Linux system and MacBook).

So, each time you want to make a switch to different connected systems or if the monitor connections are under power saving time-out, you will need to re-boot or replug cables to make re-initial the video bus communications between your shared monitor and connected systems.

It's a very command problem with most of the KVM switches not supporting EDID feeding functions.

Find a DDM-class KVM switch will solve the issues.