Replicate pressing spacebar preview using script

What is happening when you press and hold spacebar in edit view?
Is there a script that replicates this as a toggle to turn the preview mode on/off?

It’sa temporary switch to a different tool. What do you want to do?

Using spacebar, the filled preview (without any metrics, cursor position, etc) is only visible as long as spacebar is held down. I’m looking for a way to use it as a click on and click off toggle.

You can select the hand tool. The space bar is just a temporary trigger for it.

Ah okay. That’s simple enough. Guess I never use the hand tool.

Or consider the black fill plug-in.