mainWindow
Signature | hs.application:mainWindow() -> hs.window object or nil |
---|---|
Type | Method |
Description | Returns the main window of the given app, or nil. Parameters:
Returns:
|
Manipulate running applications
Signature | hs.application.applicationForPID(pid) -> hs.application object or nil |
---|---|
Type | Function |
Description | Returns the running app for the given pid, if it exists. Parameters:
Returns:
|
Signature | hs.application.applicationsForBundleID(bundleID) -> list of hs.application objects |
---|---|
Type | Function |
Description | Returns any running apps that have the given bundleID. Parameters:
Returns:
|
Signature | hs.application.defaultAppForUTI(uti) -> string or nil |
---|---|
Type | Function |
Description | Returns the bundle ID of the default application for a given UTI Parameters:
Returns:
|
Signature | hs.application.enableSpotlightForNameSearches([state]) -> boolean |
---|---|
Type | Function |
Description | Get or set whether Spotlight should be used to find alternate names for applications. Parameters:
Returns:
Notes:
|
Signature | hs.application.frontmostApplication() -> hs.application object |
---|---|
Type | Function |
Description | Returns the application object for the frontmost (active) application. This is the application which currently receives input events. Parameters:
Returns:
|
Signature | hs.application.infoForBundleID(bundleID) -> table or nil |
---|---|
Type | Function |
Description | Gets the metadata of an application from its bundle identifier Parameters:
Returns:
|
Signature | hs.application.infoForBundlePath(bundlePath) -> table or nil |
---|---|
Type | Function |
Description | Gets the metadata of an application from its path on disk Parameters:
Returns:
|
Signature | hs.application.launchOrFocus(name) -> boolean |
---|---|
Type | Function |
Description | Launches the app with the given name, or activates it if it's already running Parameters:
Returns:
Notes:
|
Signature | hs.application.launchOrFocusByBundleID(bundleID) -> boolean |
---|---|
Type | Function |
Description | Launches the app with the given bundle ID, or activates it if it's already running Parameters:
Returns:
Notes:
|
Signature | hs.application.nameForBundleID(bundleID) -> string or nil |
---|---|
Type | Function |
Description | Gets the name of an application from its bundle identifier Parameters:
Returns:
|
Signature | hs.application.pathForBundleID(bundleID) -> string or nil |
---|---|
Type | Function |
Description | Gets the filesystem path of an application from its bundle identifier Parameters:
Returns:
|
Signature | hs.application.runningApplications() -> list of hs.application objects |
---|---|
Type | Function |
Description | Returns all running apps. Parameters:
Returns:
|
Signature | hs.application.find(hint) -> hs.application object(s) |
---|---|
Type | Constructor |
Description | Finds running applications Parameters:
Returns:
Notes:
Usage: -- by pid hs.application(42):name() --> Finder -- by bundle id hs.application'com.apple.Safari':name() --> Safari -- by name hs.application'chrome':name() --> Google Chrome -- by window title hs.application'bash':name() --> Terminal |
Signature | hs.application.get(hint) -> hs.application object |
---|---|
Type | Constructor |
Description | Gets a running application Parameters:
Returns:
Notes:
|
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:
Returns:
Notes:
|
Signature | hs.application:activate([allWindows]) -> bool |
---|---|
Type | Method |
Description | 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. Parameters:
Returns:
|
Signature | hs.application:allWindows() -> list of hs.window objects |
---|---|
Type | Method |
Description | Returns all open windows owned by the given app. Parameters:
Returns:
Notes:
|
Signature | hs.application:bundleID() -> string |
---|---|
Type | Method |
Description | Returns the bundle identifier of the app. Parameters:
Returns:
|
Signature | hs.application:findMenuItem(menuItem[, isRegex]) -> table or nil |
---|---|
Type | Method |
Description | Searches the application for a menu item Parameters:
Returns:
Notes:
|
Signature | hs.application:findWindow(titlePattern) -> hs.window object(s) |
---|---|
Type | Method |
Description | Finds windows from this application Parameters:
Returns:
|
Signature | hs.application:focusedWindow() -> hs.window object or nil |
---|---|
Type | Method |
Description | Returns the currently focused window of the application, or nil Parameters:
Returns:
|
Signature | hs.application:getMenuItems([fn]) -> table or nil | hs.application object |
---|---|
Type | Method |
Description | Gets the menu structure of the application Parameters:
Returns:
Notes:
|
Signature | hs.application:getWindow(title) -> hs.window object |
---|---|
Type | Method |
Description | Gets a specific window from this application Parameters:
Returns:
|
Signature | hs.application:hide() -> boolean |
---|---|
Type | Method |
Description | Hides the app (and all its windows). Parameters:
Returns:
|
Signature | hs.application:isFrontmost() -> boolean |
---|---|
Type | Method |
Description | Returns whether the app is the frontmost (i.e. is the currently active application) Parameters:
Returns:
|
Signature | hs.application:isHidden() -> boolean |
---|---|
Type | Method |
Description | Returns whether the app is currently hidden. Parameters:
Returns:
|
Signature | hs.application:isRunning() -> boolean |
---|---|
Type | Method |
Description | Checks if the application is still running Parameters:
Returns:
Notes:
|
Signature | hs.application:kill() |
---|---|
Type | Method |
Description | Tries to terminate the app gracefully. Parameters:
Returns:
|
Signature | hs.application:kill9() |
---|---|
Type | Method |
Description | Tries to terminate the app forcefully. Parameters:
Returns:
|
Signature | hs.application:kind() -> number |
---|---|
Type | Method |
Description | Identify the application's GUI state Parameters:
Returns:
|
Signature | hs.application:mainWindow() -> hs.window object or nil |
---|---|
Type | Method |
Description | Returns the main window of the given app, or nil. Parameters:
Returns:
|
Signature | hs.application:name() |
---|---|
Type | Method |
Description | Alias for |
Signature | hs.application:path() -> string |
---|---|
Type | Method |
Description | Returns the filesystem path of the app. Parameters:
Returns:
|
Signature | hs.application:pid() -> number |
---|---|
Type | Method |
Description | Returns the app's process identifier. Parameters:
Returns:
|
Signature | hs.application:selectMenuItem(menuitem[, isRegex]) -> true or nil |
---|---|
Type | Method |
Description | Selects a menu item (i.e. simulates clicking on the menu item) Parameters:
Returns:
Notes:
|
Signature | hs.application:title() -> string |
---|---|
Type | Method |
Description | Returns the localized name of the app (in UTF8). Parameters:
Returns:
|
Signature | hs.application:unhide() -> boolean |
---|---|
Type | Method |
Description | Unhides the app (and all its windows) if it's hidden. Parameters:
Returns:
|
Signature | hs.application:visibleWindows() -> win[] |
---|---|
Type | Method |
Description | Returns only the app's windows that are visible. Parameters:
Returns:
|