Press Spacebar at Anytime

Hello, I am trying to create a function that is called anytime the spacebar is pressed, no matter what item is focused.

thanks for any help.