IS there a recommended way to implement a laser safety switch such that the laser turns off if the cover is opened?
Yes, on the laser power supply you will have a P terminal that’s normally jumpered to ground in most K40s. Remove the jumper and put the switch in its place on the normally-open terminal. When the lid is shut it will close the switch and allow the laser to operate.
Refer to the LPSU connection guide to help determine the pinout of your supply.