#
hs.application.watcher
Watch for application launch/terminate events
This module is based primarily on code from the previous incarnation of Mjolnir by Markus Engelbrecht and Steven Degutis.
#
API Overview
Constants - Useful values which cannot be changed
activated deactivated hidden launched launching terminated unhidden
Constructors - API calls which return an object, typically one that offers API methods
new
Methods - API calls which can only be made on an object returned by a constructor
start stop
#
API Documentation
#
Constants
#
activated
#
deactivated
#
launched
#
launching
#
terminated
#
Constructors
#
new
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.application.watcher.new(fn) -> watcher
|
| Type | Constructor |
| Description | Creates an application event watcher |
| Parameters |
- fn - A function that will be called when application events happen. It should accept three parameters:
A string containing the name of the application
An event type (see the constants defined above)
An
hs.application
object representing the application, or nil if the application couldn't be found
- An
hs.application.watcher
object
- If the function is called with an event type of
hs.application.watcher.terminated
then the application name parameter will benil
and thehs.application
parameter, will only be useful for getting the UNIX process ID (i.e. the PID) of the application