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 |
|
Source | extensions/application/libapplication.m line 272 |
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 |
|
Source | extensions/application/libapplication.m line 54 |
Signature | hs.application.applicationsForBundleID(bundleID) -> list of hs.application objects |
---|---|
Type | Function |
Description |
Returns any running apps that have the given bundleID. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 71 |
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 |
|
Source | extensions/application/libapplication.m line 215 |
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 |
|
Source | extensions/application/application.lua line 429 |
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 |
|
Source | extensions/application/libapplication.m line 21 |
Signature | hs.application.infoForBundleID(bundleID) -> table or nil |
---|---|
Type | Function |
Description |
Gets the metadata of an application from its bundle identifier |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 119 |
Signature | hs.application.infoForBundlePath(bundlePath) -> table or nil |
---|---|
Type | Function |
Description |
Gets the metadata of an application from its path on disk |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 199 |
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 |
|
Source | extensions/application/libapplication.m line 1092 |
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 |
|
Source | extensions/application/libapplication.m line 1111 |
Signature | hs.application.localizationsForBundleID(bundleID) -> table or nil |
---|---|
Type | Function |
Description |
Gets a list of all the localizations contained in the bundle. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 167 |
Signature | hs.application.localizationsForBundlePath(bundlePath) -> table or nil |
---|---|
Type | Function |
Description |
Gets a list of all the localizations contained in the bundle. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 183 |
Signature | hs.application.nameForBundleID(bundleID) -> string or nil |
---|---|
Type | Function |
Description |
Gets the name of an application from its bundle identifier |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 87 |
Signature | hs.application.pathForBundleID(bundleID) -> string or nil |
---|---|
Type | Function |
Description |
Gets the filesystem path of an application from its bundle identifier |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 103 |
Signature | hs.application.preferredLocalizationsForBundleID(bundleID) -> table or nil |
---|---|
Type | Function |
Description |
Gets an ordered list of preferred localizations contained in a bundle |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 135 |
Signature | hs.application.preferredLocalizationsForBundlePath(bundlePath) -> table or nil |
---|---|
Type | Function |
Description |
Gets an ordered list of preferred localizations contained in a bundle |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 151 |
Signature | hs.application.runningApplications() -> list of hs.application objects |
---|---|
Type | Function |
Description |
Returns all running apps. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 37 |
Signature | hs.application.find(hint, exact, stringLiteral) -> 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 |
Source | extensions/application/application.lua line 106 |
Signature | hs.application.get(hint) -> hs.application object |
---|---|
Type | Constructor |
Description |
Gets a running application |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/application/application.lua line 87 |
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 |
|
Source | extensions/application/application.lua line 202 |
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 |
|
Source | extensions/application/application.lua line 62 |
Signature | hs.application:allWindows() -> list of hs.window objects |
---|---|
Type | Method |
Description |
Returns all open windows owned by the given app. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/application/libapplication.m line 246 |
Signature | hs.application:bundleID() -> string |
---|---|
Type | Method |
Description |
Returns the bundle identifier of the app. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 349 |
Signature | hs.application:findMenuItem(menuItem[, isRegex]) -> table or nil |
---|---|
Type | Method |
Description |
Searches the application for a menu item |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/application/libapplication.m line 764 |
Signature | hs.application:findWindow(titlePattern) -> hs.window object(s) |
---|---|
Type | Method |
Description |
Finds windows from this application |
Parameters |
|
Returns |
|
Source | extensions/application/application.lua line 175 |
Signature | hs.application:focusedWindow() -> hs.window object or nil |
---|---|
Type | Method |
Description |
Returns the currently focused window of the application, or nil |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 289 |
Signature | hs.application:getMenuItems([fn]) -> table or nil | hs.application object |
---|---|
Type | Method |
Description |
Gets the menu structure of the application |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/application/libapplication.m line 1025 |
Signature | hs.application:getWindow(title) -> hs.window object |
---|---|
Type | Method |
Description |
Gets a specific window from this application |
Parameters |
|
Returns |
|
Source | extensions/application/application.lua line 189 |
Signature | hs.application:hide() -> boolean |
---|---|
Type | Method |
Description |
Hides the app (and all its windows). |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 421 |
Signature | hs.application:isFrontmost() -> boolean |
---|---|
Type | Method |
Description |
Returns whether the app is the frontmost (i.e. is the currently active application) |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 490 |
Signature | hs.application:isHidden() -> boolean |
---|---|
Type | Method |
Description |
Returns whether the app is currently hidden. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 473 |
Signature | hs.application:isRunning() -> boolean |
---|---|
Type | Method |
Description |
Checks if the application is still running |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/application/libapplication.m line 383 |
Signature | hs.application:kill() |
---|---|
Type | Method |
Description |
Tries to terminate the app gracefully. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 439 |
Signature | hs.application:kill9() |
---|---|
Type | Method |
Description |
Tries to terminate the app forcefully. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 456 |
Signature | hs.application:kind() -> number |
---|---|
Type | Method |
Description |
Identify the application's GUI state |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 547 |
Signature | hs.application:mainWindow() -> hs.window object or nil |
---|---|
Type | Method |
Description |
Returns the main window of the given app, or nil. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 272 |
Signature | hs.application:name() |
---|---|
Type | Method |
Description |
Alias for |
Parameters | |
Returns | |
Source | extensions/application/application.lua line 82 |
Signature | hs.application:path() -> string |
---|---|
Type | Method |
Description |
Returns the filesystem path of the app. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 366 |
Signature | hs.application:pid() -> number |
---|---|
Type | Method |
Description |
Returns the app's process identifier. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 530 |
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 |
|
Source | extensions/application/libapplication.m line 855 |
Signature | hs.application:setFrontmost([allWindows]) -> boolean |
---|---|
Type | Method |
Description |
Sets the app to the frontmost (i.e. currently active) application |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 507 |
Signature | hs.application:title() -> string |
---|---|
Type | Method |
Description |
Returns the localized name of the app (in UTF8). |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 332 |
Signature | hs.application:unhide() -> boolean |
---|---|
Type | Method |
Description |
Unhides the app (and all its windows) if it's hidden. |
Parameters |
|
Returns |
|
Source | extensions/application/libapplication.m line 403 |
Signature | hs.application:visibleWindows() -> win[] |
---|---|
Type | Method |
Description |
Returns only the app's windows that are visible. |
Parameters |
|
Returns |
|
Source | extensions/application/application.lua line 46 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.application.html