Toggling loop mode without starting / stopping transport?

From time to time, I’ve wished to be able to turn loop mode on or off while the transport is running, without stopping. I’ve also wanted to enable loop mode before starting the transport, with the idea that the playahead could be a sort of “pre-roll” for the loop.

Is there a command available which only does the toggling, without starting or stopping the transport?