API Docs

Object representing an application. You should not instantiate this directly in JavaScript, but rather, use the methods from hs.application which will return appropriate HSApplication objects.

Properties

bundleID

string
Bundle Identifier (e.g. com.apple.Safari)

bundlePath

string
Location of the application on disk

mainWindow

HSWindow
The main window of this application, or nil if there is no main window

focusedWindow

HSWindow
The focused window of this application, or nil if there is no focused window

visibleWindows

HSWindow[]
All visible (ie non-hidden) windows of this application

Methods

kill() -> boolean

Terminate the application
kill() -> boolean
boolean
True if the application was terminated, otherwise false
const app = hs.application.matchingName("Calculator")
app.kill()

kill9() -> boolean

Force-terminate the application
kill9() -> boolean
boolean
True if the application was force-terminated, otherwise false
const app = hs.application.matchingName("Calculator")
app.kill9()

axElement() -> HSAXElement

The application's HSAXElement object, for use with the hs.ax APIs
axElement() -> HSAXElement
HSAXElement
An HSAXElement object, or nil if it could not be obtained
const app = hs.application.frontmost()
const ax = app.axElement()