Physical switch could be done with a very small magnet behind the lid surface and an opposed micro-reed switch (or other magnetically actuated on/off device) buried behind the body surface. No surface penetrations, no exposed moving parts (reed relays are hermetically sealed).
My parent’s table pads do precisely that. After a particularly baffling family tech support call I drove over. Their kitchen table pads magnetically lock to stay nicely aligned, and also either put a laptop to sleep, or keep it awake when closed depending how you place them.