Two ways, Either connec the pins the power switch goes to (it is not magic, you know)
Or - get a motherboard with an on board swith. The MSI I use has some on board sensors, amkong them one that works as power sensor. Stripe finger over it, board shuts down.