Is it possible, via an AppleScript, a background service or daemon, or any other programmatic way, to catch the following events:
- a specific app (eg Aperture, Excel ...) being launched,
- an app being closed or quitting,
- an app going to the foreground or background ?
Purpose would to be change some system state/pref (eg keyboard layout, screen profile etc) in an app-dependent manner.
Of course, suggestions of existing solutions are welcome.