Don't toggle recording if the keystroke comes from a GUI.

Pop up a confirmation dialog before toggling recording.
Moved the key handling to the keyUp() method. Don't recall why I thought
this was a good idea, but neither can I think of why it might be a bad one,
so let's go with it.