mainwindow
mjolnir.application:mainwindow() -> window
Returns the main window of the given app, or nil.
Manipulate running applications.
mjolnir.application.applicationforpid(pid) -> app or nil
Returns the running app for the given pid, if it exists.
mjolnir.application.applicationsforbundleid(bundleid) -> app[]
Returns any running apps that have the given bundleid.
mjolnir.application.launchorfocus(name) -> bool
Launches the app with the given name, or activates it if it's already running.
Returns true if it launched or was already launched; otherwise false (presumably only if the app doesn't exist).
mjolnir.application.runningapplications() -> app[]
Returns all running apps.
mjolnir.application:activate(allwindows = false) -> bool
Tries to activate the app (make its key window focused) and returns whether it succeeded; if allwindows is true, all windows of the application are brought forward as well.
mjolnir.application:allwindows() -> window[]
Returns all open windows owned by the given app.
mjolnir.application:bundleid() -> string
Returns the bundle identifier of the app.
mjolnir.application:hide() -> success
Hides the app (and all its windows).
mjolnir.application:kill()
Tries to terminate the app.
mjolnir.application:kill9()
Assuredly terminates the app.
mjolnir.application:kind() -> number
Returns 1 if the app is in the dock, 0 if not, and -1 if it can't even have GUI elements if it wanted to.
mjolnir.application:mainwindow() -> window
Returns the main window of the given app, or nil.
mjolnir.application:pid() -> number
Returns the app's process identifier.
mjolnir.application:title() -> string
Returns the localized name of the app (in UTF8).
mjolnir.application:unhide() -> success
Unhides the app (and all its windows) if it's hidden.
mjolnir.application:visiblewindows() -> win[]
Returns only the app's windows that are visible.