Signature |
hs.application.open(app[, wait, [waitForFirstWindow]]) -> hs.application object |
Type |
Constructor |
Description |
Launches an application, or activates it if it's already running |
Parameters |
- app - a string describing the application to open; it can be: - the application's name as per
hs.application:name() - the full path to an application on disk (including the .app suffix) - the application's bundle ID as per hs.application:bundleID()
- wait - (optional) the maximum number of seconds to wait for the app to be launched, if not already running; if omitted, defaults to 0; if the app takes longer than this to launch, this function will return
nil , but the app will still launch
- waitForFirstWindow - (optional) if
true , additionally wait until the app has spawned its first window (which usually takes a bit longer)
|
Returns |
- the
hs.application object for the launched or activated application; nil if not found
|
Notes |
- the
wait parameter will block all Hammerspoon activity in order to return the application object "synchronously"; only use it if you
a) have no time-critical event processing happening elsewhere in your init.lua and b) need to act on the application object, or on
its window(s), right away
- when launching a "windowless" app (background daemon, menulet, etc.) make sure to omit
waitForFirstWindow
|
Source |
extensions/application/init.lua |