From doing some work in the past observing and learning how notifications on MacOSX work, you're going into an area that is not easy if you don't know a bit about the internals and also how to code.
From what I understand, you would have to run a process that looks for a workspace/notification of a certain event. Depending on if its a mouse click (look for the many variations of code helping enable gestures/multi touch such as multiclutch), keystrokes (logger or your usual shortcut apps come in to mind) or attaching/looking for a specific event (fsevents, launched, etc). Each area has different challenges and the mouse/keyboard stufff could involve using private/undocumented methods.
Your best bet is to use something like Spark or another watcher to perform whatever.