Almost all my wall plugs and machines are on a 2nd breaker panel that is powered up by a large relay. When the shop lights go off the relay turns off, thus cutting power to the 2nd breaker panel.
There are a few exceptions that get their power off the main breaker panel for one reason or another. Most plugs and motors in the shop though, including the compressor, are off if the lights are off.
There are a few benefits to wiring a shop this way. First, automatic devices like air compressors cannot come on due to leaks in the system. Also any sawdust that has infiltrated into electrical components over the years can't start a fire.
Actually, the compressor is double guarded. Not only does it get its power off the relayed breaker pane but there is also an air solenoid on the air outlet port that also activates by the relay. So even if there is air leakage in the shop air lines the compressor doesn't drain down because the air output is cut off from the rest of the system when I'm not in the shop.
I've done this in various shops I've had over the past 20 to 30 years. It's a great way to prevent a number of potential problems.
BH Davis