I am running virtual machines for testing on a second Space using Virtualbox, and the problem is that when I'm on the primary space, the virtual machine continues to use a lot of CPU time and kills the battery.
Right now I try to remember to manually Pause the virtual machine every time I switch back to my primary space, but that gets tedious and I'd like to do it automatically.
So the question is:
How can I send the CTRL + CMD + P shortcut key combination to the virtual machine to pause it every time it loses focus, or alternatively whenever I switch back to Space 1.
Ideally it would also send the combination again when I switch to the Space with Virtualbox running on it, but that isn't as important.
I've been able to solve the problem using third-party software - Keyboard Maestro triggering the command-line VBoxManage tool and sending a Pause command that way. But there must be a way to do it without paying for software.