OS X notifications: Activate terminal when clicked.

- Backport the 'activate' option from terminal-notifier. This makes sure that
  the notification is removed when clicked and can optionally activate an app.
- Use the 'TERM_PROGRAM' environment variable to detect the terminal and use
  the appropriate activate option. Supports Apple Terminal and iTerm. Else it
  defaults to no app activation.