Skip to content

Instantly share code, notes, and snippets.

@muescha
Created November 21, 2022 09:58
Show Gist options
  • Save muescha/8d6cb4197d0aaf312c7c940f452c00fd to your computer and use it in GitHub Desktop.
Save muescha/8d6cb4197d0aaf312c7c940f452c00fd to your computer and use it in GitHub Desktop.
/Applications/Hammerspoon.app/Contents/Resources/docs.json
This file has been truncated, but you can view the full file.
[
{
"Command": [],
"Constant": [
{
"def": "hs.configdir",
"desc": "A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`",
"doc": "A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "44",
"name": "configdir",
"signature": "hs.configdir",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.docstrings_json_file",
"desc": "A string containing the full path to the `docs.json` file inside Hammerspoon's app bundle. This contains the full Hammerspoon API documentation and can be accessed in the Console using `help(\"someAPI\")`. It can also be loaded and processed by the `hs.doc` extension",
"doc": "A string containing the full path to the `docs.json` file inside Hammerspoon's app bundle. This contains the full Hammerspoon API documentation and can be accessed in the Console using `help(\"someAPI\")`. It can also be loaded and processed by the `hs.doc` extension",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "144",
"name": "docstrings_json_file",
"signature": "hs.docstrings_json_file",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.processInfo",
"desc": "A table containing read-only information about the Hammerspoon application instance currently running.",
"doc": "A table containing read-only information about the Hammerspoon application instance currently running.",
"file": "Hammerspoon/MJLua.m",
"lineno": "227",
"name": "processInfo",
"signature": "hs.processInfo",
"stripped_doc": "",
"type": "Constant"
}
],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.accessibilityState(shouldPrompt) -> isEnabled",
"desc": "Checks the Accessibility Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Accessibility Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Accessibility is not currently enabled for Hammerspoon. Defaults to false.\n\nReturns:\n * True or False indicating whether or not Accessibility is enabled for Hammerspoon.\n\nNotes:\n * Since this check is done automatically when Hammerspoon loads, it is probably of limited use except for skipping things that are known to fail when Accessibility is not enabled. Evettaps which try to capture keyUp and keyDown events, for example, will fail until Accessibility is enabled and the Hammerspoon application is relaunched.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "273",
"name": "accessibilityState",
"notes": [
" * Since this check is done automatically when Hammerspoon loads, it is probably of limited use except for skipping things that are known to fail when Accessibility is not enabled. Evettaps which try to capture keyUp and keyDown events, for example, will fail until Accessibility is enabled and the Hammerspoon application is relaunched."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Accessibility is not currently enabled for Hammerspoon. Defaults to false."
],
"returns": [
" * True or False indicating whether or not Accessibility is enabled for Hammerspoon."
],
"signature": "hs.accessibilityState(shouldPrompt) -> isEnabled",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.allowAppleScript([state]) -> bool",
"desc": "Set or display whether or not external Hammerspoon AppleScript commands are allowed.",
"doc": "Set or display whether or not external Hammerspoon AppleScript commands are allowed.\n\nParameters:\n * state - an optional boolean which will set whether or not external Hammerspoon's AppleScript commands are allowed.\n\nReturns:\n * A boolean, `true` if Hammerspoon's AppleScript commands are (or has just been) allowed, otherwise `false`.\n\nNotes:\n * AppleScript access is disallowed by default.\n * However due to the way AppleScript support works, Hammerspoon will always allow AppleScript commands that are part of the \"Standard Suite\", such as `name`, `quit`, `version`, etc. However, Hammerspoon will only allow commands from the \"Hammerspoon Suite\" if `hs.allowAppleScript()` is set to `true`.\n * For a full list of AppleScript Commands:\n - Open `/Applications/Utilities/Script Editor.app`\n - Click `File > Open Dictionary...`\n - Select Hammerspoon from the list of Applications\n - This will now open a Dictionary containing all of the availible Hammerspoon AppleScript commands.\n * Note that strings within the Lua code you pass from AppleScript can be delimited by `[[` and `]]` rather than normal quotes\n * Example:\n ```lua\n tell application \"Hammerspoon\"\n execute lua code \"hs.alert([[Hello from AppleScript]])\"\n end tell```",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "673",
"name": "allowAppleScript",
"notes": [
" * AppleScript access is disallowed by default.",
" * However due to the way AppleScript support works, Hammerspoon will always allow AppleScript commands that are part of the \"Standard Suite\", such as `name`, `quit`, `version`, etc. However, Hammerspoon will only allow commands from the \"Hammerspoon Suite\" if `hs.allowAppleScript()` is set to `true`.",
" * For a full list of AppleScript Commands:",
" - Open `/Applications/Utilities/Script Editor.app`",
" - Click `File > Open Dictionary...`",
" - Select Hammerspoon from the list of Applications",
" - This will now open a Dictionary containing all of the availible Hammerspoon AppleScript commands.",
" * Note that strings within the Lua code you pass from AppleScript can be delimited by `[[` and `]]` rather than normal quotes",
" * Example:",
" ```lua",
" tell application \"Hammerspoon\"",
" execute lua code \"hs.alert([[Hello from AppleScript]])\"",
" end tell```"
],
"parameters": [
" * state - an optional boolean which will set whether or not external Hammerspoon's AppleScript commands are allowed."
],
"returns": [
" * A boolean, `true` if Hammerspoon's AppleScript commands are (or has just been) allowed, otherwise `false`."
],
"signature": "hs.allowAppleScript([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.autoLaunch([state]) -> bool",
"desc": "Set or display the \"Launch on Login\" status for Hammerspoon.",
"doc": "Set or display the \"Launch on Login\" status for Hammerspoon.\n\nParameters:\n * state - an optional boolean which will set whether or not Hammerspoon should be launched automatically when you log into your computer.\n\nReturns:\n * True if Hammerspoon is currently (or has just been) set to launch on login or False if Hammerspoon is not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "66",
"name": "autoLaunch",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not Hammerspoon should be launched automatically when you log into your computer."
],
"returns": [
" * True if Hammerspoon is currently (or has just been) set to launch on login or False if Hammerspoon is not."
],
"signature": "hs.autoLaunch([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.automaticallyCheckForUpdates([setting]) -> bool",
"desc": "Gets and optionally sets the Hammerspoon option to automatically check for updates.",
"doc": "Gets and optionally sets the Hammerspoon option to automatically check for updates.\n\nParameters:\n * setting - an optional boolean variable indicating if Hammerspoon should (true) or should not (false) check for updates.\n\nReturns:\n * The current (or newly set) value indicating whether or not automatic update checks should occur for Hammerspoon.\n\nNotes:\n * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "490",
"name": "automaticallyCheckForUpdates",
"notes": [
" * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified."
],
"parameters": [
" * setting - an optional boolean variable indicating if Hammerspoon should (true) or should not (false) check for updates."
],
"returns": [
" * The current (or newly set) value indicating whether or not automatic update checks should occur for Hammerspoon."
],
"signature": "hs.automaticallyCheckForUpdates([setting]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.cameraState(shouldPrompt) -> boolean",
"desc": "Checks the Camera Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Camera Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if we should request camear access. Defaults to false.\n\nReturns:\n * `true` or `false` indicating whether or not Camera access is enabled for Hammerspoon.\n\nNotes:\n * Will always return `true` on macOS 10.13 or earlier.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "431",
"name": "cameraState",
"notes": [
" * Will always return `true` on macOS 10.13 or earlier."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if we should request camear access. Defaults to false."
],
"returns": [
" * `true` or `false` indicating whether or not Camera access is enabled for Hammerspoon."
],
"signature": "hs.cameraState(shouldPrompt) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.canCheckForUpdates() -> boolean",
"desc": "Returns a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates.",
"doc": "Returns a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates.\n\nParameters:\n * None\n\nReturns:\n * a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates\n\nNotes:\n * The Sparkle framework is included in all regular releases of Hammerspoon but not included if you are running a non-release or locally compiled version of Hammerspoon, so this function can be used as a simple test to determine whether or not you are running a formal release Hammerspoon or not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "624",
"name": "canCheckForUpdates",
"notes": [
" * The Sparkle framework is included in all regular releases of Hammerspoon but not included if you are running a non-release or locally compiled version of Hammerspoon, so this function can be used as a simple test to determine whether or not you are running a formal release Hammerspoon or not."
],
"parameters": [
" * None"
],
"returns": [
" * a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates"
],
"signature": "hs.canCheckForUpdates() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.checkForUpdates([silent]) -> none",
"desc": "Check for an update now, and if one is available, prompt the user to continue the update process.",
"doc": "Check for an update now, and if one is available, prompt the user to continue the update process.\n\nParameters:\n * silent - An optional boolean. If true, no UI will be displayed if an update is available. Defaults to false.\n\nReturns:\n * None\n\nNotes:\n * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "549",
"name": "checkForUpdates",
"notes": [
" * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified."
],
"parameters": [
" * silent - An optional boolean. If true, no UI will be displayed if an update is available. Defaults to false."
],
"returns": [
" * None"
],
"signature": "hs.checkForUpdates([silent]) -> none",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.cleanUTF8forConsole(inString) -> outString",
"desc": "Returns a copy of the incoming string that can be displayed in the Hammerspoon console. Invalid UTF8 sequences are converted to the Unicode Replacement Character and NULL (0x00) is converted to the Unicode Empty Set character.",
"doc": "Returns a copy of the incoming string that can be displayed in the Hammerspoon console. Invalid UTF8 sequences are converted to the Unicode Replacement Character and NULL (0x00) is converted to the Unicode Empty Set character.\n\nParameters:\n * inString - the string to be cleaned up\n\nReturns:\n * outString - the cleaned up version of the input string.\n\nNotes:\n * This function is applied automatically to all output which appears in the Hammerspoon console, but not to the output provided by the `hs` command line tool.\n * This function does not modify the original string - to actually replace it, assign the result of this function to the original string.\n * This function is a more specifically targeted version of the `hs.utf8.fixUTF8(...)` function.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "763",
"name": "cleanUTF8forConsole",
"notes": [
" * This function is applied automatically to all output which appears in the Hammerspoon console, but not to the output provided by the `hs` command line tool.",
" * This function does not modify the original string - to actually replace it, assign the result of this function to the original string.",
" * This function is a more specifically targeted version of the `hs.utf8.fixUTF8(...)` function."
],
"parameters": [
" * inString - the string to be cleaned up"
],
"returns": [
" * outString - the cleaned up version of the input string."
],
"signature": "hs.cleanUTF8forConsole(inString) -> outString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.closeConsole()",
"desc": "Closes the Hammerspoon Console window",
"doc": "Closes the Hammerspoon Console window\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "178",
"name": "closeConsole",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.closeConsole()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.closePreferences()",
"desc": "Closes the Hammerspoon Preferences window",
"doc": "Closes the Hammerspoon Preferences window\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "148",
"name": "closePreferences",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.closePreferences()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.consoleOnTop([state]) -> bool",
"desc": "Set or display whether or not the Hammerspoon console is always on top when visible.",
"doc": "Set or display whether or not the Hammerspoon console is always on top when visible.\n\nParameters:\n * state - an optional boolean which will set whether or not the Hammerspoon console is always on top when visible.\n\nReturns:\n * True if the console is currently set (or has just been) to be always on top when visible or False if it is not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "102",
"name": "consoleOnTop",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not the Hammerspoon console is always on top when visible."
],
"returns": [
" * True if the console is currently set (or has just been) to be always on top when visible or False if it is not."
],
"signature": "hs.consoleOnTop([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.coroutineApplicationYield([delay])",
"desc": "Yield coroutine to allow the Hammerspoon application to process other scheduled events and schedule a resume in the event application queue.",
"doc": "Yield coroutine to allow the Hammerspoon application to process other scheduled events and schedule a resume in the event application queue.\n\nParameters:\n * `delay` - an optional number, default `hs.math.minFloat`, specifying the number of seconds from when this function is executed that the `coroutine.resume` should be scheduled for.\n\nReturns:\n * None\n\nNotes:\n * this function will return an error if invoked outside of a coroutine.\n * unlike `coroutine.yield`, this function does not allow the passing of (new) information to or from the coroutine while it is running; this function is to allow long running tasks to yield time to the Hammerspoon application so other timers and scheduled events can occur without requiring the programmer to add code for an explicit resume.\n\n * this function is added to the lua `coroutine` library as `coroutine.applicationYield` as an alternative name.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "106",
"name": "coroutineApplicationYield",
"notes": [
" * this function will return an error if invoked outside of a coroutine.",
" * unlike `coroutine.yield`, this function does not allow the passing of (new) information to or from the coroutine while it is running; this function is to allow long running tasks to yield time to the Hammerspoon application so other timers and scheduled events can occur without requiring the programmer to add code for an explicit resume.",
"",
" * this function is added to the lua `coroutine` library as `coroutine.applicationYield` as an alternative name."
],
"parameters": [
" * `delay` - an optional number, default `hs.math.minFloat`, specifying the number of seconds from when this function is executed that the `coroutine.resume` should be scheduled for."
],
"returns": [
" * None"
],
"signature": "hs.coroutineApplicationYield([delay])",
"stripped_doc": " * this function is added to the lua `coroutine` library as `coroutine.applicationYield` as an alternative name.",
"type": "Function"
},
{
"def": "hs.dockIcon([state]) -> bool",
"desc": "Set or display whether or not the Hammerspoon dock icon is visible.",
"doc": "Set or display whether or not the Hammerspoon dock icon is visible.\n\nParameters:\n * state - an optional boolean which will set whether or not the Hammerspoon dock icon should be visible.\n\nReturns:\n * True if the icon is currently set (or has just been) to be visible or False if it is not.\n\nNotes:\n * This function is a wrapper to functions found in the `hs.dockicon` module, but is provided here to provide an interface consistent with other selectable preference items.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "262",
"name": "dockIcon",
"notes": [
" * This function is a wrapper to functions found in the `hs.dockicon` module, but is provided here to provide an interface consistent with other selectable preference items."
],
"parameters": [
" * state - an optional boolean which will set whether or not the Hammerspoon dock icon should be visible."
],
"returns": [
" * True if the icon is currently set (or has just been) to be visible or False if it is not."
],
"signature": "hs.dockIcon([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.execute(command[, with_user_env]) -> output, status, type, rc",
"desc": "Runs a shell command, optionally loading the users shell environment first, and returns stdout as a string, followed by the same result codes as `os.execute` would return.",
"doc": "Runs a shell command, optionally loading the users shell environment first, and returns stdout as a string, followed by the same result codes as `os.execute` would return.\n\nParameters:\n * command - a string containing the shell command to execute\n * with_user_env - optional boolean argument which if provided and is true, executes the command in the users login shell as an \"interactive\" login shell causing the user's local profile (or other login scripts) to be loaded first.\n\nReturns:\n * output -- the stdout of the command as a string. May contain an extra terminating new-line (\\n).\n * status -- `true` if the command terminated successfully or nil otherwise.\n * type -- a string value of \"exit\" or \"signal\" indicating whether the command terminated of its own accord or if it was terminated by a signal (killed, segfault, etc.)\n * rc -- if the command exited of its own accord, then this number will represent the exit code (usually 0 for success, not 0 for an error, though this is very command specific, so check man pages when there is a question). If the command was killed by a signal, then this number corresponds to the signal type that caused the command to terminate.\n\nNotes:\n * Setting `with_user_env` to true does incur noticeable overhead, so it should only be used if necessary (to set the path or other environment variables).\n * Because this function returns the stdout as it's first return value, it is not quite a drop-in replacement for `os.execute`. In most cases, it is probable that `stdout` will be the empty string when `status` is nil, but this is not guaranteed, so this trade off of shifting os.execute's results was deemed acceptable.\n * This particular function is most useful when you're more interested in the command's output then a simple check for completion and result codes. If you only require the result codes or verification of command completion, then `os.execute` will be slightly more efficient.\n * If you need to execute commands that have spaces in their paths, use a form like: `hs.execute [[\"/Some/Path To/An/Executable\" \"--first-arg\" \"second-arg\"]]`",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "231",
"name": "execute",
"notes": [
" * Setting `with_user_env` to true does incur noticeable overhead, so it should only be used if necessary (to set the path or other environment variables).",
" * Because this function returns the stdout as it's first return value, it is not quite a drop-in replacement for `os.execute`. In most cases, it is probable that `stdout` will be the empty string when `status` is nil, but this is not guaranteed, so this trade off of shifting os.execute's results was deemed acceptable.",
" * This particular function is most useful when you're more interested in the command's output then a simple check for completion and result codes. If you only require the result codes or verification of command completion, then `os.execute` will be slightly more efficient.",
" * If you need to execute commands that have spaces in their paths, use a form like: `hs.execute [[\"/Some/Path To/An/Executable\" \"--first-arg\" \"second-arg\"]]`"
],
"parameters": [
" * command - a string containing the shell command to execute",
" * with_user_env - optional boolean argument which if provided and is true, executes the command in the users login shell as an \"interactive\" login shell causing the user's local profile (or other login scripts) to be loaded first."
],
"returns": [
" * output -- the stdout of the command as a string. May contain an extra terminating new-line (\\n).",
" * status -- `true` if the command terminated successfully or nil otherwise.",
" * type -- a string value of \"exit\" or \"signal\" indicating whether the command terminated of its own accord or if it was terminated by a signal (killed, segfault, etc.)",
" * rc -- if the command exited of its own accord, then this number will represent the exit code (usually 0 for success, not 0 for an error, though this is very command specific, so check man pages when there is a question). If the command was killed by a signal, then this number corresponds to the signal type that caused the command to terminate."
],
"signature": "hs.execute(command[, with_user_env]) -> output, status, type, rc",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.focus()",
"desc": "Makes Hammerspoon the foreground app.",
"doc": "Makes Hammerspoon the foreground app.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "733",
"name": "focus",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.focus()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.getObjectMetatable(name) -> table or nil",
"desc": "Fetches the Lua metatable for objects produced by an extension",
"doc": "Fetches the Lua metatable for objects produced by an extension\n\nParameters:\n * name - A string containing the name of a module to fetch object metadata for (e.g. `\"hs.screen\"`)\n\nReturns:\n * The extension's object metatable, or nil if an error occurred",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "747",
"name": "getObjectMetatable",
"notes": [],
"parameters": [
" * name - A string containing the name of a module to fetch object metadata for (e.g. `\"hs.screen\"`)"
],
"returns": [
" * The extension's object metatable, or nil if an error occurred"
],
"signature": "hs.getObjectMetatable(name) -> table or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.help(identifier)",
"desc": "Prints the documentation for some part of Hammerspoon's API and Lua 5.3. This function is actually sourced from hs.doc.help.",
"doc": "Prints the documentation for some part of Hammerspoon's API and Lua 5.3. This function is actually sourced from hs.doc.help.\n\nParameters:\n * identifier - A string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`)\n\nReturns:\n * None\n\nNotes:\n * This function is mainly for runtime API help while using Hammerspoon's Console\n * You can also access the results of this function by the following methods from the console:\n * help(\"identifier\") -- quotes are required, e.g. `help(\"hs.reload\")`\n * help.identifier.path -- no quotes are required, e.g. `help.hs.reload`\n * Lua information can be accessed by using the `lua` prefix, rather than `hs`.\n * the identifier `lua._man` provides the table of contents for the Lua 5.3 manual. You can pull up a specific section of the lua manual by including the chapter (and subsection) like this: `lua._man._3_4_8`.\n * the identifier `lua._C` will provide information specifically about the Lua C API for use when developing modules which require external libraries.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "370",
"name": "help",
"notes": [
" * This function is mainly for runtime API help while using Hammerspoon's Console",
" * You can also access the results of this function by the following methods from the console:",
" * help(\"identifier\") -- quotes are required, e.g. `help(\"hs.reload\")`",
" * help.identifier.path -- no quotes are required, e.g. `help.hs.reload`",
" * Lua information can be accessed by using the `lua` prefix, rather than `hs`.",
" * the identifier `lua._man` provides the table of contents for the Lua 5.3 manual. You can pull up a specific section of the lua manual by including the chapter (and subsection) like this: `lua._man._3_4_8`.",
" * the identifier `lua._C` will provide information specifically about the Lua C API for use when developing modules which require external libraries."
],
"parameters": [
" * identifier - A string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`)"
],
"returns": [
" * None"
],
"signature": "hs.help(identifier)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.hsdocs([identifier])",
"desc": "Display's Hammerspoon API documentation in a webview browser.",
"doc": "Display's Hammerspoon API documentation in a webview browser.\n\nParameters:\n * identifier - An optional string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`). If no string is provided, then the table of contents for the Hammerspoon documentation is displayed.\n\nReturns:\n * None\n\nNotes:\n * You can also access the results of this function by the following methods from the console:\n * hs.hsdocs.identifier.path -- no quotes are required, e.g. `hs.hsdocs.hs.reload`\n * See `hs.doc.hsdocs` for more information about the available settings for the documentation browser.\n * This function provides documentation for Hammerspoon modules, functions, and methods similar to the Hammerspoon Dash docset, but does not require any additional software.\n * This currently only provides documentation for the built in Hammerspoon modules, functions, and methods. The Lua documentation and third-party modules are not presently supported, but may be added in a future release.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "393",
"name": "hsdocs",
"notes": [
" * You can also access the results of this function by the following methods from the console:",
" * hs.hsdocs.identifier.path -- no quotes are required, e.g. `hs.hsdocs.hs.reload`",
" * See `hs.doc.hsdocs` for more information about the available settings for the documentation browser.",
" * This function provides documentation for Hammerspoon modules, functions, and methods similar to the Hammerspoon Dash docset, but does not require any additional software.",
" * This currently only provides documentation for the built in Hammerspoon modules, functions, and methods. The Lua documentation and third-party modules are not presently supported, but may be added in a future release."
],
"parameters": [
" * identifier - An optional string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`). If no string is provided, then the table of contents for the Hammerspoon documentation is displayed."
],
"returns": [
" * None"
],
"signature": "hs.hsdocs([identifier])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.loadSpoon(name[, global]) -> Spoon object",
"desc": "Loads a Spoon",
"doc": "Loads a Spoon\n\nParameters:\n * name - The name of a Spoon (without the trailing `.spoon`)\n * global - An optional boolean. If true, this function will insert the spoon into Lua's global namespace as `spoon.NAME`. Defaults to true.\n\nReturns:\n * The object provided by the Spoon (which can be ignored if you chose to make the Spoon global)\n\nNotes:\n * Spoons are a way of distributing self-contained units of Lua functionality, for Hammerspoon. For more information, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md\n * This function will load the Spoon and call its `:init()` method if it has one. If you do not wish this to happen, or wish to use a Spoon that somehow doesn't fit with the behaviours of this function, you can also simply `require('name')` to load the Spoon\n * If the Spoon has a `:start()` method you are responsible for calling it before using the functionality of the Spoon.\n * If the Spoon provides documentation, it will be loaded by made available in hs.docs\n * To learn how to distribute your own code as a Spoon, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "282",
"name": "loadSpoon",
"notes": [
" * Spoons are a way of distributing self-contained units of Lua functionality, for Hammerspoon. For more information, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md",
" * This function will load the Spoon and call its `:init()` method if it has one. If you do not wish this to happen, or wish to use a Spoon that somehow doesn't fit with the behaviours of this function, you can also simply `require('name')` to load the Spoon",
" * If the Spoon has a `:start()` method you are responsible for calling it before using the functionality of the Spoon.",
" * If the Spoon provides documentation, it will be loaded by made available in hs.docs",
" * To learn how to distribute your own code as a Spoon, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md"
],
"parameters": [
" * name - The name of a Spoon (without the trailing `.spoon`)",
" * global - An optional boolean. If true, this function will insert the spoon into Lua's global namespace as `spoon.NAME`. Defaults to true."
],
"returns": [
" * The object provided by the Spoon (which can be ignored if you chose to make the Spoon global)"
],
"signature": "hs.loadSpoon(name[, global]) -> Spoon object",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.menuIcon([state]) -> bool",
"desc": "Set or display whether or not the Hammerspoon menu icon is visible.",
"doc": "Set or display whether or not the Hammerspoon menu icon is visible.\n\nParameters:\n * state - an optional boolean which will set whether or not the Hammerspoon menu icon should be visible.\n\nReturns:\n * True if the icon is currently set (or has just been) to be visible or False if it is not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "81",
"name": "menuIcon",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not the Hammerspoon menu icon should be visible."
],
"returns": [
" * True if the icon is currently set (or has just been) to be visible or False if it is not."
],
"signature": "hs.menuIcon([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.microphoneState(shouldPrompt) -> boolean",
"desc": "Checks the Microphone Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Microphone Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if we should request microphone access. Defaults to false.\n\nReturns:\n * `true` or `false` indicating whether or not Microphone access is enabled for Hammerspoon.\n\nNotes:\n * Will always return `true` on macOS 10.13 or earlier.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "372",
"name": "microphoneState",
"notes": [
" * Will always return `true` on macOS 10.13 or earlier."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if we should request microphone access. Defaults to false."
],
"returns": [
" * `true` or `false` indicating whether or not Microphone access is enabled for Hammerspoon."
],
"signature": "hs.microphoneState(shouldPrompt) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.open(filePath)",
"desc": "Opens a file as if it were opened with /usr/bin/open",
"doc": "Opens a file as if it were opened with /usr/bin/open\n\nParameters:\n * filePath - A string containing the path to a file/bundle to open\n\nReturns:\n * A boolean, true if the file was opened successfully, otherwise false",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "192",
"name": "open",
"notes": [],
"parameters": [
" * filePath - A string containing the path to a file/bundle to open"
],
"returns": [
" * A boolean, true if the file was opened successfully, otherwise false"
],
"signature": "hs.open(filePath)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openAbout()",
"desc": "Displays the OS X About panel for Hammerspoon; implicitly focuses Hammerspoon.",
"doc": "Displays the OS X About panel for Hammerspoon; implicitly focuses Hammerspoon.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "117",
"name": "openAbout",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.openAbout()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openConsole([bringToFront])",
"desc": "Opens the Hammerspoon Console window and optionally focuses it.",
"doc": "Opens the Hammerspoon Console window and optionally focuses it.\n\nParameters:\n * bringToFront - if true (default), the console will be focused as well as opened.\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "162",
"name": "openConsole",
"notes": [],
"parameters": [
" * bringToFront - if true (default), the console will be focused as well as opened."
],
"returns": [
" * None"
],
"signature": "hs.openConsole([bringToFront])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openConsoleOnDockClick([state]) -> bool",
"desc": "Set or display whether or not the Console window will open when the Hammerspoon dock icon is clicked",
"doc": "Set or display whether or not the Console window will open when the Hammerspoon dock icon is clicked\n\nParameters:\n * state - An optional boolean, true if the console window should open, false if not\n\nReturns:\n * A boolean, true if the console window will open when the dock icon\n\nNotes:\n * This only refers to dock icon clicks while Hammerspoon is already running. The console window is not opened by launching the app",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "709",
"name": "openConsoleOnDockClick",
"notes": [
" * This only refers to dock icon clicks while Hammerspoon is already running. The console window is not opened by launching the app"
],
"parameters": [
" * state - An optional boolean, true if the console window should open, false if not"
],
"returns": [
" * A boolean, true if the console window will open when the dock icon"
],
"signature": "hs.openConsoleOnDockClick([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openPreferences()",
"desc": "Displays the Hammerspoon Preferences panel; implicitly focuses Hammerspoon.",
"doc": "Displays the Hammerspoon Preferences panel; implicitly focuses Hammerspoon.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "132",
"name": "openPreferences",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.openPreferences()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.preferencesDarkMode([state]) -> bool",
"desc": "Set or display whether or not the Preferences panel should display in dark mode.",
"doc": "Set or display whether or not the Preferences panel should display in dark mode.\n\nParameters:\n * state - an optional boolean which will set whether or not the Preferences panel should display in dark mode.\n\nReturns:\n * A boolean, true if dark mode is enabled otherwise false.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "651",
"name": "preferencesDarkMode",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not the Preferences panel should display in dark mode."
],
"returns": [
" * A boolean, true if dark mode is enabled otherwise false."
],
"signature": "hs.preferencesDarkMode([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.printf(format, ...)",
"desc": "Prints formatted strings to the Console",
"doc": "Prints formatted strings to the Console\n\nParameters:\n * format - A format string\n * ... - Zero or more arguments to fill the placeholders in the format string\n\nReturns:\n * None\n\nNotes:\n * This is a simple wrapper around the Lua code `print(string.format(...))`.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "13",
"name": "printf",
"notes": [
" * This is a simple wrapper around the Lua code `print(string.format(...))`."
],
"parameters": [
" * format - A format string",
" * ... - Zero or more arguments to fill the placeholders in the format string"
],
"returns": [
" * None"
],
"signature": "hs.printf(format, ...)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.rawprint(aString)",
"desc": "The original Lua print() function",
"doc": "The original Lua print() function\n\nParameters:\n * aString - A string to be printed\n\nReturns:\n * None\n\nNotes:\n * Hammerspoon overrides Lua's print() function, but this is a reference we retain to is, should you need it for any reason",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "205",
"name": "rawprint",
"notes": [
" * Hammerspoon overrides Lua's print() function, but this is a reference we retain to is, should you need it for any reason"
],
"parameters": [
" * aString - A string to be printed"
],
"returns": [
" * None"
],
"signature": "hs.rawprint(aString)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.relaunch()",
"desc": "Quits and relaunches Hammerspoon.",
"doc": "Quits and relaunches Hammerspoon.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "92",
"name": "relaunch",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.relaunch()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.reload()",
"desc": "Reloads your init-file in a fresh Lua environment.",
"doc": "Reloads your init-file in a fresh Lua environment.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "211",
"name": "reload",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.reload()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.screenRecordingState(shouldPrompt) -> isEnabled",
"desc": "Checks the Screen Recording Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Screen Recording Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Screen Recording is not currently enabled for Hammerspoon. Defaults to false.\n\nReturns:\n * True or False indicating whether or not Screen Recording is enabled for Hammerspoon.\n\nNotes:\n * If you trigger the prompt and the user denies it, you cannot bring up the prompt again - the user must manually enable it in System Preferences.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "346",
"name": "screenRecordingState",
"notes": [
" * If you trigger the prompt and the user denies it, you cannot bring up the prompt again - the user must manually enable it in System Preferences."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Screen Recording is not currently enabled for Hammerspoon. Defaults to false."
],
"returns": [
" * True or False indicating whether or not Screen Recording is enabled for Hammerspoon."
],
"signature": "hs.screenRecordingState(shouldPrompt) -> isEnabled",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.showError(err)",
"desc": "Shows an error to the user, using Hammerspoon's Console",
"doc": "Shows an error to the user, using Hammerspoon's Console\n\nParameters:\n * err - A string containing an error message\n\nReturns:\n * None\n\nNotes:\n * This function is called whenever an (uncaught) error occurs or is thrown (via `error()`)\n * The default implementation shows a notification, opens the Console, and prints the error message and stacktrace\n * You can override this function if you wish to route errors differently (e.g. for remote systems)",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "149",
"name": "showError",
"notes": [
" * This function is called whenever an (uncaught) error occurs or is thrown (via `error()`)",
" * The default implementation shows a notification, opens the Console, and prints the error message and stacktrace",
" * You can override this function if you wish to route errors differently (e.g. for remote systems)"
],
"parameters": [
" * err - A string containing an error message"
],
"returns": [
" * None"
],
"signature": "hs.showError(err)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.toggleConsole()",
"desc": "Toggles the visibility of the console",
"doc": "Toggles the visibility of the console\n\nParameters:\n * None\n\nReturns:\n * None\n\nNotes:\n * If the console is not currently open, it will be opened. If it is open and not the focused window, it will be brought forward and focused.\n * If the console is focused, it will be closed.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "181",
"name": "toggleConsole",
"notes": [
" * If the console is not currently open, it will be opened. If it is open and not the focused window, it will be brought forward and focused.",
" * If the console is focused, it will be closed."
],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.toggleConsole()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.updateAvailable() -> string or false, string",
"desc": "Gets the version & build number of an available update",
"doc": "Gets the version & build number of an available update\n\nParameters:\n * None\n\nReturns:\n * A string containing the display version of the latest release, or a boolean false if no update is available\n * A string containing the build number of the latest release, or `nil` if no update is available\n\nNotes:\n * This is not a live check, it is a cached result of whatever the previous update check found. By default Hammerspoon checks for updates every few hours, but you can also add your own timer to check for updates more frequently with `hs.checkForUpdates()`",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "588",
"name": "updateAvailable",
"notes": [
" * This is not a live check, it is a cached result of whatever the previous update check found. By default Hammerspoon checks for updates every few hours, but you can also add your own timer to check for updates more frequently with `hs.checkForUpdates()`"
],
"parameters": [
" * None"
],
"returns": [
" * A string containing the display version of the latest release, or a boolean false if no update is available",
" * A string containing the build number of the latest release, or `nil` if no update is available"
],
"signature": "hs.updateAvailable() -> string or false, string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.uploadCrashData([state]) -> bool",
"desc": "Get or set the \"Upload Crash Data\" preference for Hammerspoon",
"doc": "Get or set the \"Upload Crash Data\" preference for Hammerspoon\n\nParameters:\n * state - An optional boolean, true to upload crash reports, false to not\n\nReturns:\n * True if Hammerspoon is currently (or has just been) set to upload crash data or False otherwise\n\nNotes:\n * If at all possible, please do allow Hammerspoon to upload crash reports to us, it helps a great deal in keeping Hammerspoon stable\n * Our Privacy Policy can be found here: [https://www.hammerspoon.org/privacy.html](https://www.hammerspoon.org/privacy.html)",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "47",
"name": "uploadCrashData",
"notes": [
" * If at all possible, please do allow Hammerspoon to upload crash reports to us, it helps a great deal in keeping Hammerspoon stable",
" * Our Privacy Policy can be found here: [https://www.hammerspoon.org/privacy.html](https://www.hammerspoon.org/privacy.html)"
],
"parameters": [
" * state - An optional boolean, true to upload crash reports, false to not"
],
"returns": [
" * True if Hammerspoon is currently (or has just been) set to upload crash data or False otherwise"
],
"signature": "hs.uploadCrashData([state]) -> bool",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [
{
"def": "hs.accessibilityStateCallback",
"desc": "An optional function that will be called when the Accessibility State is changed.",
"doc": "An optional function that will be called when the Accessibility State is changed.\n\nNotes:\n * The function will not receive any arguments when called. To check what the accessibility state has been changed to, you should call [hs.accessibilityState](#accessibilityState) from within your function.",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "66",
"name": "accessibilityStateCallback",
"notes": [
" * The function will not receive any arguments when called. To check what the accessibility state has been changed to, you should call [hs.accessibilityState](#accessibilityState) from within your function."
],
"signature": "hs.accessibilityStateCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.completionsForInputString(completionWord) -> table of strings",
"desc": "Gathers tab completion options for the Console window",
"doc": "Gathers tab completion options for the Console window\n\nParameters:\n * completionWord - A string from the Console window's input field that completions are needed for\n\nReturns:\n * A table of strings, each of which will be shown as a possible completion option to the user\n\nNotes:\n * Hammerspoon provides a default implementation of this function, which can complete against the global Lua namespace, the 'hs' (i.e. extension) namespace, and object metatables. You can assign a new function to the variable to replace it with your own variant.",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "584",
"name": "completionsForInputString",
"notes": [
" * Hammerspoon provides a default implementation of this function, which can complete against the global Lua namespace, the 'hs' (i.e. extension) namespace, and object metatables. You can assign a new function to the variable to replace it with your own variant."
],
"parameters": [
" * completionWord - A string from the Console window's input field that completions are needed for"
],
"returns": [
" * A table of strings, each of which will be shown as a possible completion option to the user"
],
"signature": "hs.completionsForInputString(completionWord) -> table of strings",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.dockIconClickCallback",
"desc": "An optional function that will be called when the Hammerspoon Dock Icon is clicked while the app is running",
"doc": "An optional function that will be called when the Hammerspoon Dock Icon is clicked while the app is running\n\nNotes:\n * If set, this callback will be called regardless of whether or not Hammerspoon shows its console window in response to a click (which can be enabled/disabled via `hs.openConsoleOnDockClick()`",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "49",
"name": "dockIconClickCallback",
"notes": [
" * If set, this callback will be called regardless of whether or not Hammerspoon shows its console window in response to a click (which can be enabled/disabled via `hs.openConsoleOnDockClick()`"
],
"signature": "hs.dockIconClickCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.fileDroppedToDockIconCallback",
"desc": "An optional function that will be called when a files are dragged to the Hammerspoon Dock Icon or sent via the Services menu",
"doc": "An optional function that will be called when a files are dragged to the Hammerspoon Dock Icon or sent via the Services menu\n\nNotes:\n * The function should accept a single parameter, which will be a string containing the full path to the file that was dragged to the dock icon\n * If multiple files are sent, this callback will be called once for each file\n * This callback will be triggered when ANY file type is dragged onto the Hammerspoon Dock Icon, however certain filetypes are also processed seperately by Hammerspoon. For example, `hs.urlevent` will be triggered when the following filetypes are dropped onto the Dock Icon: HTML Documents (.html, .htm, .shtml, .jhtml), Plain text documents (.txt, .text), Web site locations (.url), XHTML documents (.xhtml, .xht, .xhtm, .xht).",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "82",
"name": "fileDroppedToDockIconCallback",
"notes": [
" * The function should accept a single parameter, which will be a string containing the full path to the file that was dragged to the dock icon",
" * If multiple files are sent, this callback will be called once for each file",
" * This callback will be triggered when ANY file type is dragged onto the Hammerspoon Dock Icon, however certain filetypes are also processed seperately by Hammerspoon. For example, `hs.urlevent` will be triggered when the following filetypes are dropped onto the Dock Icon: HTML Documents (.html, .htm, .shtml, .jhtml), Plain text documents (.txt, .text), Web site locations (.url), XHTML documents (.xhtml, .xht, .xhtm, .xht)."
],
"signature": "hs.fileDroppedToDockIconCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.shutdownCallback",
"desc": "An optional function that will be called when the Lua environment is being destroyed (either because Hammerspoon is exiting or reloading its config)",
"doc": "An optional function that will be called when the Lua environment is being destroyed (either because Hammerspoon is exiting or reloading its config)\n\nNotes:\n * This function should not perform any asynchronous tasks\n * You do not need to fastidiously destroy objects you have created, this callback exists purely for utility reasons (e.g. serialising state, destroying system resources that will not be released by normal Lua garbage collection processes, etc)",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "57",
"name": "shutdownCallback",
"notes": [
" * This function should not perform any asynchronous tasks",
" * You do not need to fastidiously destroy objects you have created, this callback exists purely for utility reasons (e.g. serialising state, destroying system resources that will not be released by normal Lua garbage collection processes, etc)"
],
"signature": "hs.shutdownCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.textDroppedToDockIconCallback",
"desc": "An optional function that will be called when text is dragged to the Hammerspoon Dock Icon or sent via the Services menu",
"doc": "An optional function that will be called when text is dragged to the Hammerspoon Dock Icon or sent via the Services menu\n\nNotes:\n * The function should accept a single parameter, which will be a string containing the text that was dragged to the dock icon",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "74",
"name": "textDroppedToDockIconCallback",
"notes": [
" * The function should accept a single parameter, which will be a string containing the text that was dragged to the dock icon"
],
"signature": "hs.textDroppedToDockIconCallback",
"stripped_doc": "",
"type": "Variable"
}
],
"desc": "Core Hammerspoon functionality",
"doc": "Core Hammerspoon functionality",
"items": [
{
"def": "hs.accessibilityState(shouldPrompt) -> isEnabled",
"desc": "Checks the Accessibility Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Accessibility Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Accessibility is not currently enabled for Hammerspoon. Defaults to false.\n\nReturns:\n * True or False indicating whether or not Accessibility is enabled for Hammerspoon.\n\nNotes:\n * Since this check is done automatically when Hammerspoon loads, it is probably of limited use except for skipping things that are known to fail when Accessibility is not enabled. Evettaps which try to capture keyUp and keyDown events, for example, will fail until Accessibility is enabled and the Hammerspoon application is relaunched.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "273",
"name": "accessibilityState",
"notes": [
" * Since this check is done automatically when Hammerspoon loads, it is probably of limited use except for skipping things that are known to fail when Accessibility is not enabled. Evettaps which try to capture keyUp and keyDown events, for example, will fail until Accessibility is enabled and the Hammerspoon application is relaunched."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Accessibility is not currently enabled for Hammerspoon. Defaults to false."
],
"returns": [
" * True or False indicating whether or not Accessibility is enabled for Hammerspoon."
],
"signature": "hs.accessibilityState(shouldPrompt) -> isEnabled",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.accessibilityStateCallback",
"desc": "An optional function that will be called when the Accessibility State is changed.",
"doc": "An optional function that will be called when the Accessibility State is changed.\n\nNotes:\n * The function will not receive any arguments when called. To check what the accessibility state has been changed to, you should call [hs.accessibilityState](#accessibilityState) from within your function.",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "66",
"name": "accessibilityStateCallback",
"notes": [
" * The function will not receive any arguments when called. To check what the accessibility state has been changed to, you should call [hs.accessibilityState](#accessibilityState) from within your function."
],
"signature": "hs.accessibilityStateCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.allowAppleScript([state]) -> bool",
"desc": "Set or display whether or not external Hammerspoon AppleScript commands are allowed.",
"doc": "Set or display whether or not external Hammerspoon AppleScript commands are allowed.\n\nParameters:\n * state - an optional boolean which will set whether or not external Hammerspoon's AppleScript commands are allowed.\n\nReturns:\n * A boolean, `true` if Hammerspoon's AppleScript commands are (or has just been) allowed, otherwise `false`.\n\nNotes:\n * AppleScript access is disallowed by default.\n * However due to the way AppleScript support works, Hammerspoon will always allow AppleScript commands that are part of the \"Standard Suite\", such as `name`, `quit`, `version`, etc. However, Hammerspoon will only allow commands from the \"Hammerspoon Suite\" if `hs.allowAppleScript()` is set to `true`.\n * For a full list of AppleScript Commands:\n - Open `/Applications/Utilities/Script Editor.app`\n - Click `File > Open Dictionary...`\n - Select Hammerspoon from the list of Applications\n - This will now open a Dictionary containing all of the availible Hammerspoon AppleScript commands.\n * Note that strings within the Lua code you pass from AppleScript can be delimited by `[[` and `]]` rather than normal quotes\n * Example:\n ```lua\n tell application \"Hammerspoon\"\n execute lua code \"hs.alert([[Hello from AppleScript]])\"\n end tell```",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "673",
"name": "allowAppleScript",
"notes": [
" * AppleScript access is disallowed by default.",
" * However due to the way AppleScript support works, Hammerspoon will always allow AppleScript commands that are part of the \"Standard Suite\", such as `name`, `quit`, `version`, etc. However, Hammerspoon will only allow commands from the \"Hammerspoon Suite\" if `hs.allowAppleScript()` is set to `true`.",
" * For a full list of AppleScript Commands:",
" - Open `/Applications/Utilities/Script Editor.app`",
" - Click `File > Open Dictionary...`",
" - Select Hammerspoon from the list of Applications",
" - This will now open a Dictionary containing all of the availible Hammerspoon AppleScript commands.",
" * Note that strings within the Lua code you pass from AppleScript can be delimited by `[[` and `]]` rather than normal quotes",
" * Example:",
" ```lua",
" tell application \"Hammerspoon\"",
" execute lua code \"hs.alert([[Hello from AppleScript]])\"",
" end tell```"
],
"parameters": [
" * state - an optional boolean which will set whether or not external Hammerspoon's AppleScript commands are allowed."
],
"returns": [
" * A boolean, `true` if Hammerspoon's AppleScript commands are (or has just been) allowed, otherwise `false`."
],
"signature": "hs.allowAppleScript([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.autoLaunch([state]) -> bool",
"desc": "Set or display the \"Launch on Login\" status for Hammerspoon.",
"doc": "Set or display the \"Launch on Login\" status for Hammerspoon.\n\nParameters:\n * state - an optional boolean which will set whether or not Hammerspoon should be launched automatically when you log into your computer.\n\nReturns:\n * True if Hammerspoon is currently (or has just been) set to launch on login or False if Hammerspoon is not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "66",
"name": "autoLaunch",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not Hammerspoon should be launched automatically when you log into your computer."
],
"returns": [
" * True if Hammerspoon is currently (or has just been) set to launch on login or False if Hammerspoon is not."
],
"signature": "hs.autoLaunch([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.automaticallyCheckForUpdates([setting]) -> bool",
"desc": "Gets and optionally sets the Hammerspoon option to automatically check for updates.",
"doc": "Gets and optionally sets the Hammerspoon option to automatically check for updates.\n\nParameters:\n * setting - an optional boolean variable indicating if Hammerspoon should (true) or should not (false) check for updates.\n\nReturns:\n * The current (or newly set) value indicating whether or not automatic update checks should occur for Hammerspoon.\n\nNotes:\n * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "490",
"name": "automaticallyCheckForUpdates",
"notes": [
" * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified."
],
"parameters": [
" * setting - an optional boolean variable indicating if Hammerspoon should (true) or should not (false) check for updates."
],
"returns": [
" * The current (or newly set) value indicating whether or not automatic update checks should occur for Hammerspoon."
],
"signature": "hs.automaticallyCheckForUpdates([setting]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.cameraState(shouldPrompt) -> boolean",
"desc": "Checks the Camera Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Camera Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if we should request camear access. Defaults to false.\n\nReturns:\n * `true` or `false` indicating whether or not Camera access is enabled for Hammerspoon.\n\nNotes:\n * Will always return `true` on macOS 10.13 or earlier.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "431",
"name": "cameraState",
"notes": [
" * Will always return `true` on macOS 10.13 or earlier."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if we should request camear access. Defaults to false."
],
"returns": [
" * `true` or `false` indicating whether or not Camera access is enabled for Hammerspoon."
],
"signature": "hs.cameraState(shouldPrompt) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.canCheckForUpdates() -> boolean",
"desc": "Returns a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates.",
"doc": "Returns a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates.\n\nParameters:\n * None\n\nReturns:\n * a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates\n\nNotes:\n * The Sparkle framework is included in all regular releases of Hammerspoon but not included if you are running a non-release or locally compiled version of Hammerspoon, so this function can be used as a simple test to determine whether or not you are running a formal release Hammerspoon or not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "624",
"name": "canCheckForUpdates",
"notes": [
" * The Sparkle framework is included in all regular releases of Hammerspoon but not included if you are running a non-release or locally compiled version of Hammerspoon, so this function can be used as a simple test to determine whether or not you are running a formal release Hammerspoon or not."
],
"parameters": [
" * None"
],
"returns": [
" * a boolean indicating whether or not the Sparkle framework is available to check for Hammerspoon updates"
],
"signature": "hs.canCheckForUpdates() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.checkForUpdates([silent]) -> none",
"desc": "Check for an update now, and if one is available, prompt the user to continue the update process.",
"doc": "Check for an update now, and if one is available, prompt the user to continue the update process.\n\nParameters:\n * silent - An optional boolean. If true, no UI will be displayed if an update is available. Defaults to false.\n\nReturns:\n * None\n\nNotes:\n * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "549",
"name": "checkForUpdates",
"notes": [
" * If you are running a non-release or locally compiled version of Hammerspoon then the results of this function are unspecified."
],
"parameters": [
" * silent - An optional boolean. If true, no UI will be displayed if an update is available. Defaults to false."
],
"returns": [
" * None"
],
"signature": "hs.checkForUpdates([silent]) -> none",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.cleanUTF8forConsole(inString) -> outString",
"desc": "Returns a copy of the incoming string that can be displayed in the Hammerspoon console. Invalid UTF8 sequences are converted to the Unicode Replacement Character and NULL (0x00) is converted to the Unicode Empty Set character.",
"doc": "Returns a copy of the incoming string that can be displayed in the Hammerspoon console. Invalid UTF8 sequences are converted to the Unicode Replacement Character and NULL (0x00) is converted to the Unicode Empty Set character.\n\nParameters:\n * inString - the string to be cleaned up\n\nReturns:\n * outString - the cleaned up version of the input string.\n\nNotes:\n * This function is applied automatically to all output which appears in the Hammerspoon console, but not to the output provided by the `hs` command line tool.\n * This function does not modify the original string - to actually replace it, assign the result of this function to the original string.\n * This function is a more specifically targeted version of the `hs.utf8.fixUTF8(...)` function.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "763",
"name": "cleanUTF8forConsole",
"notes": [
" * This function is applied automatically to all output which appears in the Hammerspoon console, but not to the output provided by the `hs` command line tool.",
" * This function does not modify the original string - to actually replace it, assign the result of this function to the original string.",
" * This function is a more specifically targeted version of the `hs.utf8.fixUTF8(...)` function."
],
"parameters": [
" * inString - the string to be cleaned up"
],
"returns": [
" * outString - the cleaned up version of the input string."
],
"signature": "hs.cleanUTF8forConsole(inString) -> outString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.closeConsole()",
"desc": "Closes the Hammerspoon Console window",
"doc": "Closes the Hammerspoon Console window\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "178",
"name": "closeConsole",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.closeConsole()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.closePreferences()",
"desc": "Closes the Hammerspoon Preferences window",
"doc": "Closes the Hammerspoon Preferences window\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "148",
"name": "closePreferences",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.closePreferences()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.completionsForInputString(completionWord) -> table of strings",
"desc": "Gathers tab completion options for the Console window",
"doc": "Gathers tab completion options for the Console window\n\nParameters:\n * completionWord - A string from the Console window's input field that completions are needed for\n\nReturns:\n * A table of strings, each of which will be shown as a possible completion option to the user\n\nNotes:\n * Hammerspoon provides a default implementation of this function, which can complete against the global Lua namespace, the 'hs' (i.e. extension) namespace, and object metatables. You can assign a new function to the variable to replace it with your own variant.",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "584",
"name": "completionsForInputString",
"notes": [
" * Hammerspoon provides a default implementation of this function, which can complete against the global Lua namespace, the 'hs' (i.e. extension) namespace, and object metatables. You can assign a new function to the variable to replace it with your own variant."
],
"parameters": [
" * completionWord - A string from the Console window's input field that completions are needed for"
],
"returns": [
" * A table of strings, each of which will be shown as a possible completion option to the user"
],
"signature": "hs.completionsForInputString(completionWord) -> table of strings",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.configdir",
"desc": "A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`",
"doc": "A string containing Hammerspoon's configuration directory. Typically `~/.hammerspoon/`",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "44",
"name": "configdir",
"signature": "hs.configdir",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.consoleOnTop([state]) -> bool",
"desc": "Set or display whether or not the Hammerspoon console is always on top when visible.",
"doc": "Set or display whether or not the Hammerspoon console is always on top when visible.\n\nParameters:\n * state - an optional boolean which will set whether or not the Hammerspoon console is always on top when visible.\n\nReturns:\n * True if the console is currently set (or has just been) to be always on top when visible or False if it is not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "102",
"name": "consoleOnTop",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not the Hammerspoon console is always on top when visible."
],
"returns": [
" * True if the console is currently set (or has just been) to be always on top when visible or False if it is not."
],
"signature": "hs.consoleOnTop([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.coroutineApplicationYield([delay])",
"desc": "Yield coroutine to allow the Hammerspoon application to process other scheduled events and schedule a resume in the event application queue.",
"doc": "Yield coroutine to allow the Hammerspoon application to process other scheduled events and schedule a resume in the event application queue.\n\nParameters:\n * `delay` - an optional number, default `hs.math.minFloat`, specifying the number of seconds from when this function is executed that the `coroutine.resume` should be scheduled for.\n\nReturns:\n * None\n\nNotes:\n * this function will return an error if invoked outside of a coroutine.\n * unlike `coroutine.yield`, this function does not allow the passing of (new) information to or from the coroutine while it is running; this function is to allow long running tasks to yield time to the Hammerspoon application so other timers and scheduled events can occur without requiring the programmer to add code for an explicit resume.\n\n * this function is added to the lua `coroutine` library as `coroutine.applicationYield` as an alternative name.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "106",
"name": "coroutineApplicationYield",
"notes": [
" * this function will return an error if invoked outside of a coroutine.",
" * unlike `coroutine.yield`, this function does not allow the passing of (new) information to or from the coroutine while it is running; this function is to allow long running tasks to yield time to the Hammerspoon application so other timers and scheduled events can occur without requiring the programmer to add code for an explicit resume.",
"",
" * this function is added to the lua `coroutine` library as `coroutine.applicationYield` as an alternative name."
],
"parameters": [
" * `delay` - an optional number, default `hs.math.minFloat`, specifying the number of seconds from when this function is executed that the `coroutine.resume` should be scheduled for."
],
"returns": [
" * None"
],
"signature": "hs.coroutineApplicationYield([delay])",
"stripped_doc": " * this function is added to the lua `coroutine` library as `coroutine.applicationYield` as an alternative name.",
"type": "Function"
},
{
"def": "hs.dockIcon([state]) -> bool",
"desc": "Set or display whether or not the Hammerspoon dock icon is visible.",
"doc": "Set or display whether or not the Hammerspoon dock icon is visible.\n\nParameters:\n * state - an optional boolean which will set whether or not the Hammerspoon dock icon should be visible.\n\nReturns:\n * True if the icon is currently set (or has just been) to be visible or False if it is not.\n\nNotes:\n * This function is a wrapper to functions found in the `hs.dockicon` module, but is provided here to provide an interface consistent with other selectable preference items.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "262",
"name": "dockIcon",
"notes": [
" * This function is a wrapper to functions found in the `hs.dockicon` module, but is provided here to provide an interface consistent with other selectable preference items."
],
"parameters": [
" * state - an optional boolean which will set whether or not the Hammerspoon dock icon should be visible."
],
"returns": [
" * True if the icon is currently set (or has just been) to be visible or False if it is not."
],
"signature": "hs.dockIcon([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.dockIconClickCallback",
"desc": "An optional function that will be called when the Hammerspoon Dock Icon is clicked while the app is running",
"doc": "An optional function that will be called when the Hammerspoon Dock Icon is clicked while the app is running\n\nNotes:\n * If set, this callback will be called regardless of whether or not Hammerspoon shows its console window in response to a click (which can be enabled/disabled via `hs.openConsoleOnDockClick()`",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "49",
"name": "dockIconClickCallback",
"notes": [
" * If set, this callback will be called regardless of whether or not Hammerspoon shows its console window in response to a click (which can be enabled/disabled via `hs.openConsoleOnDockClick()`"
],
"signature": "hs.dockIconClickCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.docstrings_json_file",
"desc": "A string containing the full path to the `docs.json` file inside Hammerspoon's app bundle. This contains the full Hammerspoon API documentation and can be accessed in the Console using `help(\"someAPI\")`. It can also be loaded and processed by the `hs.doc` extension",
"doc": "A string containing the full path to the `docs.json` file inside Hammerspoon's app bundle. This contains the full Hammerspoon API documentation and can be accessed in the Console using `help(\"someAPI\")`. It can also be loaded and processed by the `hs.doc` extension",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "144",
"name": "docstrings_json_file",
"signature": "hs.docstrings_json_file",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.execute(command[, with_user_env]) -> output, status, type, rc",
"desc": "Runs a shell command, optionally loading the users shell environment first, and returns stdout as a string, followed by the same result codes as `os.execute` would return.",
"doc": "Runs a shell command, optionally loading the users shell environment first, and returns stdout as a string, followed by the same result codes as `os.execute` would return.\n\nParameters:\n * command - a string containing the shell command to execute\n * with_user_env - optional boolean argument which if provided and is true, executes the command in the users login shell as an \"interactive\" login shell causing the user's local profile (or other login scripts) to be loaded first.\n\nReturns:\n * output -- the stdout of the command as a string. May contain an extra terminating new-line (\\n).\n * status -- `true` if the command terminated successfully or nil otherwise.\n * type -- a string value of \"exit\" or \"signal\" indicating whether the command terminated of its own accord or if it was terminated by a signal (killed, segfault, etc.)\n * rc -- if the command exited of its own accord, then this number will represent the exit code (usually 0 for success, not 0 for an error, though this is very command specific, so check man pages when there is a question). If the command was killed by a signal, then this number corresponds to the signal type that caused the command to terminate.\n\nNotes:\n * Setting `with_user_env` to true does incur noticeable overhead, so it should only be used if necessary (to set the path or other environment variables).\n * Because this function returns the stdout as it's first return value, it is not quite a drop-in replacement for `os.execute`. In most cases, it is probable that `stdout` will be the empty string when `status` is nil, but this is not guaranteed, so this trade off of shifting os.execute's results was deemed acceptable.\n * This particular function is most useful when you're more interested in the command's output then a simple check for completion and result codes. If you only require the result codes or verification of command completion, then `os.execute` will be slightly more efficient.\n * If you need to execute commands that have spaces in their paths, use a form like: `hs.execute [[\"/Some/Path To/An/Executable\" \"--first-arg\" \"second-arg\"]]`",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "231",
"name": "execute",
"notes": [
" * Setting `with_user_env` to true does incur noticeable overhead, so it should only be used if necessary (to set the path or other environment variables).",
" * Because this function returns the stdout as it's first return value, it is not quite a drop-in replacement for `os.execute`. In most cases, it is probable that `stdout` will be the empty string when `status` is nil, but this is not guaranteed, so this trade off of shifting os.execute's results was deemed acceptable.",
" * This particular function is most useful when you're more interested in the command's output then a simple check for completion and result codes. If you only require the result codes or verification of command completion, then `os.execute` will be slightly more efficient.",
" * If you need to execute commands that have spaces in their paths, use a form like: `hs.execute [[\"/Some/Path To/An/Executable\" \"--first-arg\" \"second-arg\"]]`"
],
"parameters": [
" * command - a string containing the shell command to execute",
" * with_user_env - optional boolean argument which if provided and is true, executes the command in the users login shell as an \"interactive\" login shell causing the user's local profile (or other login scripts) to be loaded first."
],
"returns": [
" * output -- the stdout of the command as a string. May contain an extra terminating new-line (\\n).",
" * status -- `true` if the command terminated successfully or nil otherwise.",
" * type -- a string value of \"exit\" or \"signal\" indicating whether the command terminated of its own accord or if it was terminated by a signal (killed, segfault, etc.)",
" * rc -- if the command exited of its own accord, then this number will represent the exit code (usually 0 for success, not 0 for an error, though this is very command specific, so check man pages when there is a question). If the command was killed by a signal, then this number corresponds to the signal type that caused the command to terminate."
],
"signature": "hs.execute(command[, with_user_env]) -> output, status, type, rc",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.fileDroppedToDockIconCallback",
"desc": "An optional function that will be called when a files are dragged to the Hammerspoon Dock Icon or sent via the Services menu",
"doc": "An optional function that will be called when a files are dragged to the Hammerspoon Dock Icon or sent via the Services menu\n\nNotes:\n * The function should accept a single parameter, which will be a string containing the full path to the file that was dragged to the dock icon\n * If multiple files are sent, this callback will be called once for each file\n * This callback will be triggered when ANY file type is dragged onto the Hammerspoon Dock Icon, however certain filetypes are also processed seperately by Hammerspoon. For example, `hs.urlevent` will be triggered when the following filetypes are dropped onto the Dock Icon: HTML Documents (.html, .htm, .shtml, .jhtml), Plain text documents (.txt, .text), Web site locations (.url), XHTML documents (.xhtml, .xht, .xhtm, .xht).",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "82",
"name": "fileDroppedToDockIconCallback",
"notes": [
" * The function should accept a single parameter, which will be a string containing the full path to the file that was dragged to the dock icon",
" * If multiple files are sent, this callback will be called once for each file",
" * This callback will be triggered when ANY file type is dragged onto the Hammerspoon Dock Icon, however certain filetypes are also processed seperately by Hammerspoon. For example, `hs.urlevent` will be triggered when the following filetypes are dropped onto the Dock Icon: HTML Documents (.html, .htm, .shtml, .jhtml), Plain text documents (.txt, .text), Web site locations (.url), XHTML documents (.xhtml, .xht, .xhtm, .xht)."
],
"signature": "hs.fileDroppedToDockIconCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.focus()",
"desc": "Makes Hammerspoon the foreground app.",
"doc": "Makes Hammerspoon the foreground app.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "733",
"name": "focus",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.focus()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.getObjectMetatable(name) -> table or nil",
"desc": "Fetches the Lua metatable for objects produced by an extension",
"doc": "Fetches the Lua metatable for objects produced by an extension\n\nParameters:\n * name - A string containing the name of a module to fetch object metadata for (e.g. `\"hs.screen\"`)\n\nReturns:\n * The extension's object metatable, or nil if an error occurred",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "747",
"name": "getObjectMetatable",
"notes": [],
"parameters": [
" * name - A string containing the name of a module to fetch object metadata for (e.g. `\"hs.screen\"`)"
],
"returns": [
" * The extension's object metatable, or nil if an error occurred"
],
"signature": "hs.getObjectMetatable(name) -> table or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.help(identifier)",
"desc": "Prints the documentation for some part of Hammerspoon's API and Lua 5.3. This function is actually sourced from hs.doc.help.",
"doc": "Prints the documentation for some part of Hammerspoon's API and Lua 5.3. This function is actually sourced from hs.doc.help.\n\nParameters:\n * identifier - A string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`)\n\nReturns:\n * None\n\nNotes:\n * This function is mainly for runtime API help while using Hammerspoon's Console\n * You can also access the results of this function by the following methods from the console:\n * help(\"identifier\") -- quotes are required, e.g. `help(\"hs.reload\")`\n * help.identifier.path -- no quotes are required, e.g. `help.hs.reload`\n * Lua information can be accessed by using the `lua` prefix, rather than `hs`.\n * the identifier `lua._man` provides the table of contents for the Lua 5.3 manual. You can pull up a specific section of the lua manual by including the chapter (and subsection) like this: `lua._man._3_4_8`.\n * the identifier `lua._C` will provide information specifically about the Lua C API for use when developing modules which require external libraries.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "370",
"name": "help",
"notes": [
" * This function is mainly for runtime API help while using Hammerspoon's Console",
" * You can also access the results of this function by the following methods from the console:",
" * help(\"identifier\") -- quotes are required, e.g. `help(\"hs.reload\")`",
" * help.identifier.path -- no quotes are required, e.g. `help.hs.reload`",
" * Lua information can be accessed by using the `lua` prefix, rather than `hs`.",
" * the identifier `lua._man` provides the table of contents for the Lua 5.3 manual. You can pull up a specific section of the lua manual by including the chapter (and subsection) like this: `lua._man._3_4_8`.",
" * the identifier `lua._C` will provide information specifically about the Lua C API for use when developing modules which require external libraries."
],
"parameters": [
" * identifier - A string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`)"
],
"returns": [
" * None"
],
"signature": "hs.help(identifier)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.hsdocs([identifier])",
"desc": "Display's Hammerspoon API documentation in a webview browser.",
"doc": "Display's Hammerspoon API documentation in a webview browser.\n\nParameters:\n * identifier - An optional string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`). If no string is provided, then the table of contents for the Hammerspoon documentation is displayed.\n\nReturns:\n * None\n\nNotes:\n * You can also access the results of this function by the following methods from the console:\n * hs.hsdocs.identifier.path -- no quotes are required, e.g. `hs.hsdocs.hs.reload`\n * See `hs.doc.hsdocs` for more information about the available settings for the documentation browser.\n * This function provides documentation for Hammerspoon modules, functions, and methods similar to the Hammerspoon Dash docset, but does not require any additional software.\n * This currently only provides documentation for the built in Hammerspoon modules, functions, and methods. The Lua documentation and third-party modules are not presently supported, but may be added in a future release.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "393",
"name": "hsdocs",
"notes": [
" * You can also access the results of this function by the following methods from the console:",
" * hs.hsdocs.identifier.path -- no quotes are required, e.g. `hs.hsdocs.hs.reload`",
" * See `hs.doc.hsdocs` for more information about the available settings for the documentation browser.",
" * This function provides documentation for Hammerspoon modules, functions, and methods similar to the Hammerspoon Dash docset, but does not require any additional software.",
" * This currently only provides documentation for the built in Hammerspoon modules, functions, and methods. The Lua documentation and third-party modules are not presently supported, but may be added in a future release."
],
"parameters": [
" * identifier - An optional string containing the signature of some part of Hammerspoon's API (e.g. `\"hs.reload\"`). If no string is provided, then the table of contents for the Hammerspoon documentation is displayed."
],
"returns": [
" * None"
],
"signature": "hs.hsdocs([identifier])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.loadSpoon(name[, global]) -> Spoon object",
"desc": "Loads a Spoon",
"doc": "Loads a Spoon\n\nParameters:\n * name - The name of a Spoon (without the trailing `.spoon`)\n * global - An optional boolean. If true, this function will insert the spoon into Lua's global namespace as `spoon.NAME`. Defaults to true.\n\nReturns:\n * The object provided by the Spoon (which can be ignored if you chose to make the Spoon global)\n\nNotes:\n * Spoons are a way of distributing self-contained units of Lua functionality, for Hammerspoon. For more information, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md\n * This function will load the Spoon and call its `:init()` method if it has one. If you do not wish this to happen, or wish to use a Spoon that somehow doesn't fit with the behaviours of this function, you can also simply `require('name')` to load the Spoon\n * If the Spoon has a `:start()` method you are responsible for calling it before using the functionality of the Spoon.\n * If the Spoon provides documentation, it will be loaded by made available in hs.docs\n * To learn how to distribute your own code as a Spoon, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "282",
"name": "loadSpoon",
"notes": [
" * Spoons are a way of distributing self-contained units of Lua functionality, for Hammerspoon. For more information, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md",
" * This function will load the Spoon and call its `:init()` method if it has one. If you do not wish this to happen, or wish to use a Spoon that somehow doesn't fit with the behaviours of this function, you can also simply `require('name')` to load the Spoon",
" * If the Spoon has a `:start()` method you are responsible for calling it before using the functionality of the Spoon.",
" * If the Spoon provides documentation, it will be loaded by made available in hs.docs",
" * To learn how to distribute your own code as a Spoon, see https://github.com/Hammerspoon/hammerspoon/blob/master/SPOON.md"
],
"parameters": [
" * name - The name of a Spoon (without the trailing `.spoon`)",
" * global - An optional boolean. If true, this function will insert the spoon into Lua's global namespace as `spoon.NAME`. Defaults to true."
],
"returns": [
" * The object provided by the Spoon (which can be ignored if you chose to make the Spoon global)"
],
"signature": "hs.loadSpoon(name[, global]) -> Spoon object",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.menuIcon([state]) -> bool",
"desc": "Set or display whether or not the Hammerspoon menu icon is visible.",
"doc": "Set or display whether or not the Hammerspoon menu icon is visible.\n\nParameters:\n * state - an optional boolean which will set whether or not the Hammerspoon menu icon should be visible.\n\nReturns:\n * True if the icon is currently set (or has just been) to be visible or False if it is not.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "81",
"name": "menuIcon",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not the Hammerspoon menu icon should be visible."
],
"returns": [
" * True if the icon is currently set (or has just been) to be visible or False if it is not."
],
"signature": "hs.menuIcon([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.microphoneState(shouldPrompt) -> boolean",
"desc": "Checks the Microphone Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Microphone Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if we should request microphone access. Defaults to false.\n\nReturns:\n * `true` or `false` indicating whether or not Microphone access is enabled for Hammerspoon.\n\nNotes:\n * Will always return `true` on macOS 10.13 or earlier.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "372",
"name": "microphoneState",
"notes": [
" * Will always return `true` on macOS 10.13 or earlier."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if we should request microphone access. Defaults to false."
],
"returns": [
" * `true` or `false` indicating whether or not Microphone access is enabled for Hammerspoon."
],
"signature": "hs.microphoneState(shouldPrompt) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.open(filePath)",
"desc": "Opens a file as if it were opened with /usr/bin/open",
"doc": "Opens a file as if it were opened with /usr/bin/open\n\nParameters:\n * filePath - A string containing the path to a file/bundle to open\n\nReturns:\n * A boolean, true if the file was opened successfully, otherwise false",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "192",
"name": "open",
"notes": [],
"parameters": [
" * filePath - A string containing the path to a file/bundle to open"
],
"returns": [
" * A boolean, true if the file was opened successfully, otherwise false"
],
"signature": "hs.open(filePath)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openAbout()",
"desc": "Displays the OS X About panel for Hammerspoon; implicitly focuses Hammerspoon.",
"doc": "Displays the OS X About panel for Hammerspoon; implicitly focuses Hammerspoon.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "117",
"name": "openAbout",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.openAbout()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openConsole([bringToFront])",
"desc": "Opens the Hammerspoon Console window and optionally focuses it.",
"doc": "Opens the Hammerspoon Console window and optionally focuses it.\n\nParameters:\n * bringToFront - if true (default), the console will be focused as well as opened.\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "162",
"name": "openConsole",
"notes": [],
"parameters": [
" * bringToFront - if true (default), the console will be focused as well as opened."
],
"returns": [
" * None"
],
"signature": "hs.openConsole([bringToFront])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openConsoleOnDockClick([state]) -> bool",
"desc": "Set or display whether or not the Console window will open when the Hammerspoon dock icon is clicked",
"doc": "Set or display whether or not the Console window will open when the Hammerspoon dock icon is clicked\n\nParameters:\n * state - An optional boolean, true if the console window should open, false if not\n\nReturns:\n * A boolean, true if the console window will open when the dock icon\n\nNotes:\n * This only refers to dock icon clicks while Hammerspoon is already running. The console window is not opened by launching the app",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "709",
"name": "openConsoleOnDockClick",
"notes": [
" * This only refers to dock icon clicks while Hammerspoon is already running. The console window is not opened by launching the app"
],
"parameters": [
" * state - An optional boolean, true if the console window should open, false if not"
],
"returns": [
" * A boolean, true if the console window will open when the dock icon"
],
"signature": "hs.openConsoleOnDockClick([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.openPreferences()",
"desc": "Displays the Hammerspoon Preferences panel; implicitly focuses Hammerspoon.",
"doc": "Displays the Hammerspoon Preferences panel; implicitly focuses Hammerspoon.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "132",
"name": "openPreferences",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.openPreferences()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.preferencesDarkMode([state]) -> bool",
"desc": "Set or display whether or not the Preferences panel should display in dark mode.",
"doc": "Set or display whether or not the Preferences panel should display in dark mode.\n\nParameters:\n * state - an optional boolean which will set whether or not the Preferences panel should display in dark mode.\n\nReturns:\n * A boolean, true if dark mode is enabled otherwise false.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "651",
"name": "preferencesDarkMode",
"notes": [],
"parameters": [
" * state - an optional boolean which will set whether or not the Preferences panel should display in dark mode."
],
"returns": [
" * A boolean, true if dark mode is enabled otherwise false."
],
"signature": "hs.preferencesDarkMode([state]) -> bool",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.printf(format, ...)",
"desc": "Prints formatted strings to the Console",
"doc": "Prints formatted strings to the Console\n\nParameters:\n * format - A format string\n * ... - Zero or more arguments to fill the placeholders in the format string\n\nReturns:\n * None\n\nNotes:\n * This is a simple wrapper around the Lua code `print(string.format(...))`.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "13",
"name": "printf",
"notes": [
" * This is a simple wrapper around the Lua code `print(string.format(...))`."
],
"parameters": [
" * format - A format string",
" * ... - Zero or more arguments to fill the placeholders in the format string"
],
"returns": [
" * None"
],
"signature": "hs.printf(format, ...)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.processInfo",
"desc": "A table containing read-only information about the Hammerspoon application instance currently running.",
"doc": "A table containing read-only information about the Hammerspoon application instance currently running.",
"file": "Hammerspoon/MJLua.m",
"lineno": "227",
"name": "processInfo",
"signature": "hs.processInfo",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.rawprint(aString)",
"desc": "The original Lua print() function",
"doc": "The original Lua print() function\n\nParameters:\n * aString - A string to be printed\n\nReturns:\n * None\n\nNotes:\n * Hammerspoon overrides Lua's print() function, but this is a reference we retain to is, should you need it for any reason",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "205",
"name": "rawprint",
"notes": [
" * Hammerspoon overrides Lua's print() function, but this is a reference we retain to is, should you need it for any reason"
],
"parameters": [
" * aString - A string to be printed"
],
"returns": [
" * None"
],
"signature": "hs.rawprint(aString)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.relaunch()",
"desc": "Quits and relaunches Hammerspoon.",
"doc": "Quits and relaunches Hammerspoon.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "92",
"name": "relaunch",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.relaunch()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.reload()",
"desc": "Reloads your init-file in a fresh Lua environment.",
"doc": "Reloads your init-file in a fresh Lua environment.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "211",
"name": "reload",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.reload()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.screenRecordingState(shouldPrompt) -> isEnabled",
"desc": "Checks the Screen Recording Permissions for Hammerspoon, and optionally allows you to prompt for permissions.",
"doc": "Checks the Screen Recording Permissions for Hammerspoon, and optionally allows you to prompt for permissions.\n\nParameters:\n * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Screen Recording is not currently enabled for Hammerspoon. Defaults to false.\n\nReturns:\n * True or False indicating whether or not Screen Recording is enabled for Hammerspoon.\n\nNotes:\n * If you trigger the prompt and the user denies it, you cannot bring up the prompt again - the user must manually enable it in System Preferences.",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "346",
"name": "screenRecordingState",
"notes": [
" * If you trigger the prompt and the user denies it, you cannot bring up the prompt again - the user must manually enable it in System Preferences."
],
"parameters": [
" * shouldPrompt - an optional boolean value indicating if the dialog box asking if the System Preferences application should be opened should be presented when Screen Recording is not currently enabled for Hammerspoon. Defaults to false."
],
"returns": [
" * True or False indicating whether or not Screen Recording is enabled for Hammerspoon."
],
"signature": "hs.screenRecordingState(shouldPrompt) -> isEnabled",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.showError(err)",
"desc": "Shows an error to the user, using Hammerspoon's Console",
"doc": "Shows an error to the user, using Hammerspoon's Console\n\nParameters:\n * err - A string containing an error message\n\nReturns:\n * None\n\nNotes:\n * This function is called whenever an (uncaught) error occurs or is thrown (via `error()`)\n * The default implementation shows a notification, opens the Console, and prints the error message and stacktrace\n * You can override this function if you wish to route errors differently (e.g. for remote systems)",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "149",
"name": "showError",
"notes": [
" * This function is called whenever an (uncaught) error occurs or is thrown (via `error()`)",
" * The default implementation shows a notification, opens the Console, and prints the error message and stacktrace",
" * You can override this function if you wish to route errors differently (e.g. for remote systems)"
],
"parameters": [
" * err - A string containing an error message"
],
"returns": [
" * None"
],
"signature": "hs.showError(err)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.shutdownCallback",
"desc": "An optional function that will be called when the Lua environment is being destroyed (either because Hammerspoon is exiting or reloading its config)",
"doc": "An optional function that will be called when the Lua environment is being destroyed (either because Hammerspoon is exiting or reloading its config)\n\nNotes:\n * This function should not perform any asynchronous tasks\n * You do not need to fastidiously destroy objects you have created, this callback exists purely for utility reasons (e.g. serialising state, destroying system resources that will not be released by normal Lua garbage collection processes, etc)",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "57",
"name": "shutdownCallback",
"notes": [
" * This function should not perform any asynchronous tasks",
" * You do not need to fastidiously destroy objects you have created, this callback exists purely for utility reasons (e.g. serialising state, destroying system resources that will not be released by normal Lua garbage collection processes, etc)"
],
"signature": "hs.shutdownCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.textDroppedToDockIconCallback",
"desc": "An optional function that will be called when text is dragged to the Hammerspoon Dock Icon or sent via the Services menu",
"doc": "An optional function that will be called when text is dragged to the Hammerspoon Dock Icon or sent via the Services menu\n\nNotes:\n * The function should accept a single parameter, which will be a string containing the text that was dragged to the dock icon",
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "74",
"name": "textDroppedToDockIconCallback",
"notes": [
" * The function should accept a single parameter, which will be a string containing the text that was dragged to the dock icon"
],
"signature": "hs.textDroppedToDockIconCallback",
"stripped_doc": "",
"type": "Variable"
},
{
"def": "hs.toggleConsole()",
"desc": "Toggles the visibility of the console",
"doc": "Toggles the visibility of the console\n\nParameters:\n * None\n\nReturns:\n * None\n\nNotes:\n * If the console is not currently open, it will be opened. If it is open and not the focused window, it will be brought forward and focused.\n * If the console is focused, it will be closed.",
"examples": [],
"file": "extensions/_coresetup/_coresetup.lua",
"lineno": "181",
"name": "toggleConsole",
"notes": [
" * If the console is not currently open, it will be opened. If it is open and not the focused window, it will be brought forward and focused.",
" * If the console is focused, it will be closed."
],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.toggleConsole()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.updateAvailable() -> string or false, string",
"desc": "Gets the version & build number of an available update",
"doc": "Gets the version & build number of an available update\n\nParameters:\n * None\n\nReturns:\n * A string containing the display version of the latest release, or a boolean false if no update is available\n * A string containing the build number of the latest release, or `nil` if no update is available\n\nNotes:\n * This is not a live check, it is a cached result of whatever the previous update check found. By default Hammerspoon checks for updates every few hours, but you can also add your own timer to check for updates more frequently with `hs.checkForUpdates()`",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "588",
"name": "updateAvailable",
"notes": [
" * This is not a live check, it is a cached result of whatever the previous update check found. By default Hammerspoon checks for updates every few hours, but you can also add your own timer to check for updates more frequently with `hs.checkForUpdates()`"
],
"parameters": [
" * None"
],
"returns": [
" * A string containing the display version of the latest release, or a boolean false if no update is available",
" * A string containing the build number of the latest release, or `nil` if no update is available"
],
"signature": "hs.updateAvailable() -> string or false, string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.uploadCrashData([state]) -> bool",
"desc": "Get or set the \"Upload Crash Data\" preference for Hammerspoon",
"doc": "Get or set the \"Upload Crash Data\" preference for Hammerspoon\n\nParameters:\n * state - An optional boolean, true to upload crash reports, false to not\n\nReturns:\n * True if Hammerspoon is currently (or has just been) set to upload crash data or False otherwise\n\nNotes:\n * If at all possible, please do allow Hammerspoon to upload crash reports to us, it helps a great deal in keeping Hammerspoon stable\n * Our Privacy Policy can be found here: [https://www.hammerspoon.org/privacy.html](https://www.hammerspoon.org/privacy.html)",
"examples": [],
"file": "Hammerspoon/MJLua.m",
"lineno": "47",
"name": "uploadCrashData",
"notes": [
" * If at all possible, please do allow Hammerspoon to upload crash reports to us, it helps a great deal in keeping Hammerspoon stable",
" * Our Privacy Policy can be found here: [https://www.hammerspoon.org/privacy.html](https://www.hammerspoon.org/privacy.html)"
],
"parameters": [
" * state - An optional boolean, true to upload crash reports, false to not"
],
"returns": [
" * True if Hammerspoon is currently (or has just been) set to upload crash data or False otherwise"
],
"signature": "hs.uploadCrashData([state]) -> bool",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs",
"stripped_doc": "",
"submodules": [
"alert",
"appfinder",
"applescript",
"application",
"audiodevice",
"axuielement",
"base64",
"battery",
"bonjour",
"brightness",
"caffeinate",
"camera",
"canvas",
"chooser",
"console",
"crash",
"deezer",
"dialog",
"distributednotifications",
"doc",
"dockicon",
"drawing",
"eventtap",
"expose",
"fnutils",
"fs",
"geometry",
"grid",
"hash",
"hid",
"hints",
"host",
"hotkey",
"http",
"httpserver",
"image",
"inspect",
"ipc",
"itunes",
"javascript",
"json",
"keycodes",
"layout",
"location",
"logger",
"math",
"menubar",
"messages",
"midi",
"milight",
"mjomatic",
"mouse",
"network",
"noises",
"notify",
"osascript",
"pasteboard",
"pathwatcher",
"plist",
"razer",
"redshift",
"screen",
"serial",
"settings",
"sharing",
"shortcuts",
"socket",
"sound",
"spaces",
"speech",
"spoons",
"spotify",
"spotlight",
"sqlite3",
"streamdeck",
"styledtext",
"tabs",
"tangent",
"task",
"timer",
"uielement",
"urlevent",
"usb",
"utf8",
"vox",
"watchable",
"websocket",
"webview",
"wifi",
"window"
],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.alert.closeAll([seconds])",
"desc": "Closes all alerts currently open on the screen",
"doc": "Closes all alerts currently open on the screen\n\nParameters:\n * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)\n\nReturns:\n * None",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "284",
"name": "closeAll",
"notes": [],
"parameters": [
" * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)"
],
"returns": [
" * None"
],
"signature": "hs.alert.closeAll([seconds])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.alert.closeSpecific(uuid, [seconds])",
"desc": "Closes the alert with the specified identifier",
"doc": "Closes the alert with the specified identifier\n\nParameters:\n * uuid - the identifier of the alert to close\n * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)\n\nReturns:\n * None\n\nNotes:\n * Use this function to close an alert which is indefinate or close an alert with a long duration early.",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "300",
"name": "closeSpecific",
"notes": [
" * Use this function to close an alert which is indefinate or close an alert with a long duration early."
],
"parameters": [
" * uuid - the identifier of the alert to close",
" * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)"
],
"returns": [
" * None"
],
"signature": "hs.alert.closeSpecific(uuid, [seconds])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.alert.show(str, [style], [screen], [seconds]) -> uuid",
"desc": "Shows a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.",
"doc": "Shows a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.\n\nParameters:\n * str - The string or `hs.styledtext` object to display in the alert\n * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.\n * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.\n * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately.\n\nReturns:\n * a string identifier for the alert.\n\nNotes:\n * For convenience, you can call this function as `hs.alert(...)`\n * This function effectively calls `hs.alert.showWithImage(msg, nil, ...)`. As such, all the same rules apply regarding argument processing",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "263",
"name": "show",
"notes": [
" * For convenience, you can call this function as `hs.alert(...)`",
" * This function effectively calls `hs.alert.showWithImage(msg, nil, ...)`. As such, all the same rules apply regarding argument processing"
],
"parameters": [
" * str - The string or `hs.styledtext` object to display in the alert",
" * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.",
" * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.",
" * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately."
],
"returns": [
" * a string identifier for the alert."
],
"signature": "hs.alert.show(str, [style], [screen], [seconds]) -> uuid",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.alert.showWithImage(str, image, [style], [screen], [seconds]) -> uuid",
"desc": "Shows an image and a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.",
"doc": "Shows an image and a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.\n\nParameters:\n * str - The string or `hs.styledtext` object to display in the alert\n * image - The image to display in the alert\n * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.\n * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.\n * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately.\n\nReturns:\n * a string identifier for the alert.\n\nNotes:\n * The optional parameters are parsed in the order presented as follows:\n * if the argument is a table and `style` has not previously been set, then the table is assigned to `style`\n * if the argument is a userdata and `screen` has not previously been set, then the userdata is assigned to `screen`\n * if `duration` has not been set, then it is assigned the value of the argument\n * if all of these conditions fail for a given argument, then an error is returned\n * The reason for this logic is to support the creation of persistent alerts as was previously handled by the module: If you specify a non-number value for `seconds` you will need to store the string identifier returned by this function so that you can close it manually with `hs.alert.closeSpecific` when the alert should be removed.\n * Any style element which is not specified in the `style` argument table will use the value currently defined in the [hs.alert.defaultStyle](#defaultStyle) table.",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "220",
"name": "showWithImage",
"notes": [
" * The optional parameters are parsed in the order presented as follows:",
" * if the argument is a table and `style` has not previously been set, then the table is assigned to `style`",
" * if the argument is a userdata and `screen` has not previously been set, then the userdata is assigned to `screen`",
" * if `duration` has not been set, then it is assigned the value of the argument",
" * if all of these conditions fail for a given argument, then an error is returned",
" * The reason for this logic is to support the creation of persistent alerts as was previously handled by the module: If you specify a non-number value for `seconds` you will need to store the string identifier returned by this function so that you can close it manually with `hs.alert.closeSpecific` when the alert should be removed.",
" * Any style element which is not specified in the `style` argument table will use the value currently defined in the [hs.alert.defaultStyle](#defaultStyle) table."
],
"parameters": [
" * str - The string or `hs.styledtext` object to display in the alert",
" * image - The image to display in the alert",
" * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.",
" * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.",
" * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately."
],
"returns": [
" * a string identifier for the alert."
],
"signature": "hs.alert.showWithImage(str, image, [style], [screen], [seconds]) -> uuid",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [
{
"def": "hs.alert.defaultStyle[]",
"desc": "A table defining the default visual style for the alerts generated by this module.",
"doc": "A table defining the default visual style for the alerts generated by this module.\n\nThe following may be specified in this table (any other key is ignored):\n * Keys which affect the alert rectangle:\n * fillColor - a table as defined by the `hs.drawing.color` module to specify the background color for the alert, defaults to { white = 0, alpha = 0.75 }.\n * strokeColor - a table as defined by the `hs.drawing.color` module to specify the outline color for the alert, defaults to { white = 1, alpha = 1 }.\n * strokeWidth - a number specifying the width of the outline for the alert, defaults to 2\n * radius - a number specifying the radius used for the rounded corners of the alert box, defaults to 27\n\n * Keys which affect the text of the alert when the message is a string (note that these keys will be ignored if the message being displayed is already an `hs.styledtext` object):\n * textColor - a table as defined by the `hs.drawing.color` module to specify the message text color for the alert, defaults to { white = 1, alpha = 1 }.\n * textFont - a string specifying the font to be used for the alert text, defaults to \".AppleSystemUIFont\" which is a symbolic name representing the systems default user interface font.\n * textSize - a number specifying the font size to be used for the alert text, defaults to 27.\n * textStyle - an optional table, defaults to `nil`, specifying that a string message should be converted to an `hs.styledtext` object using the style elements specified in this table. This table should conform to the key-value pairs as described in the documentation for the `hs.styledtext` module. If this table does not contain a `font` key-value pair, one will be constructed from the `textFont` and `textSize` keys (or their defaults); likewise, if this table does not contain a `color` key-value pair, one will be constructed from the `textColor` key (or its default).\n * padding - the number of pixels to reserve around each side of the text and/or image, defaults to textSize/2\n * atScreenEdge - 0: screen center (default); 1: top edge; 2: bottom edge . Note when atScreenEdge>0, the latest alert will overlay above the previous ones if multiple alerts visible on same edge; and when atScreenEdge=0, latest alert will show below previous visible ones without overlap.\n * fadeInDuration - a number in seconds specifying the fade in duration of the alert, defaults to 0.15\n * fadeOutDuration - a number in seconds specifying the fade out duration of the alert, defaults to 0.15\n\nIf you modify these values directly, it will affect all future alerts generated by this module. To adjust one of these properties for a single alert, use the optional `style` argument to the [hs.alert.show](#show) function.",
"file": "extensions/alert/alert.lua",
"lineno": "17",
"name": "defaultStyle",
"signature": "hs.alert.defaultStyle[]",
"stripped_doc": "The following may be specified in this table (any other key is ignored):\n * Keys which affect the alert rectangle:\n * fillColor - a table as defined by the `hs.drawing.color` module to specify the background color for the alert, defaults to { white = 0, alpha = 0.75 }.\n * strokeColor - a table as defined by the `hs.drawing.color` module to specify the outline color for the alert, defaults to { white = 1, alpha = 1 }.\n * strokeWidth - a number specifying the width of the outline for the alert, defaults to 2\n * radius - a number specifying the radius used for the rounded corners of the alert box, defaults to 27\n * Keys which affect the text of the alert when the message is a string (note that these keys will be ignored if the message being displayed is already an `hs.styledtext` object):\n * textColor - a table as defined by the `hs.drawing.color` module to specify the message text color for the alert, defaults to { white = 1, alpha = 1 }.\n * textFont - a string specifying the font to be used for the alert text, defaults to \".AppleSystemUIFont\" which is a symbolic name representing the systems default user interface font.\n * textSize - a number specifying the font size to be used for the alert text, defaults to 27.\n * textStyle - an optional table, defaults to `nil`, specifying that a string message should be converted to an `hs.styledtext` object using the style elements specified in this table. This table should conform to the key-value pairs as described in the documentation for the `hs.styledtext` module. If this table does not contain a `font` key-value pair, one will be constructed from the `textFont` and `textSize` keys (or their defaults); likewise, if this table does not contain a `color` key-value pair, one will be constructed from the `textColor` key (or its default).\n * padding - the number of pixels to reserve around each side of the text and/or image, defaults to textSize/2\n * atScreenEdge - 0: screen center (default); 1: top edge; 2: bottom edge . Note when atScreenEdge>0, the latest alert will overlay above the previous ones if multiple alerts visible on same edge; and when atScreenEdge=0, latest alert will show below previous visible ones without overlap.\n * fadeInDuration - a number in seconds specifying the fade in duration of the alert, defaults to 0.15\n * fadeOutDuration - a number in seconds specifying the fade out duration of the alert, defaults to 0.15\nIf you modify these values directly, it will affect all future alerts generated by this module. To adjust one of these properties for a single alert, use the optional `style` argument to the [hs.alert.show](#show) function.",
"type": "Variable"
}
],
"desc": "Simple on-screen alerts",
"doc": "Simple on-screen alerts",
"items": [
{
"def": "hs.alert.closeAll([seconds])",
"desc": "Closes all alerts currently open on the screen",
"doc": "Closes all alerts currently open on the screen\n\nParameters:\n * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)\n\nReturns:\n * None",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "284",
"name": "closeAll",
"notes": [],
"parameters": [
" * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)"
],
"returns": [
" * None"
],
"signature": "hs.alert.closeAll([seconds])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.alert.closeSpecific(uuid, [seconds])",
"desc": "Closes the alert with the specified identifier",
"doc": "Closes the alert with the specified identifier\n\nParameters:\n * uuid - the identifier of the alert to close\n * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)\n\nReturns:\n * None\n\nNotes:\n * Use this function to close an alert which is indefinate or close an alert with a long duration early.",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "300",
"name": "closeSpecific",
"notes": [
" * Use this function to close an alert which is indefinate or close an alert with a long duration early."
],
"parameters": [
" * uuid - the identifier of the alert to close",
" * seconds - Optional number specifying the fade out duration. Defaults to `fadeOutDuration` value currently defined in the [hs.alert.defaultStyle](#defaultStyle)"
],
"returns": [
" * None"
],
"signature": "hs.alert.closeSpecific(uuid, [seconds])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.alert.defaultStyle[]",
"desc": "A table defining the default visual style for the alerts generated by this module.",
"doc": "A table defining the default visual style for the alerts generated by this module.\n\nThe following may be specified in this table (any other key is ignored):\n * Keys which affect the alert rectangle:\n * fillColor - a table as defined by the `hs.drawing.color` module to specify the background color for the alert, defaults to { white = 0, alpha = 0.75 }.\n * strokeColor - a table as defined by the `hs.drawing.color` module to specify the outline color for the alert, defaults to { white = 1, alpha = 1 }.\n * strokeWidth - a number specifying the width of the outline for the alert, defaults to 2\n * radius - a number specifying the radius used for the rounded corners of the alert box, defaults to 27\n\n * Keys which affect the text of the alert when the message is a string (note that these keys will be ignored if the message being displayed is already an `hs.styledtext` object):\n * textColor - a table as defined by the `hs.drawing.color` module to specify the message text color for the alert, defaults to { white = 1, alpha = 1 }.\n * textFont - a string specifying the font to be used for the alert text, defaults to \".AppleSystemUIFont\" which is a symbolic name representing the systems default user interface font.\n * textSize - a number specifying the font size to be used for the alert text, defaults to 27.\n * textStyle - an optional table, defaults to `nil`, specifying that a string message should be converted to an `hs.styledtext` object using the style elements specified in this table. This table should conform to the key-value pairs as described in the documentation for the `hs.styledtext` module. If this table does not contain a `font` key-value pair, one will be constructed from the `textFont` and `textSize` keys (or their defaults); likewise, if this table does not contain a `color` key-value pair, one will be constructed from the `textColor` key (or its default).\n * padding - the number of pixels to reserve around each side of the text and/or image, defaults to textSize/2\n * atScreenEdge - 0: screen center (default); 1: top edge; 2: bottom edge . Note when atScreenEdge>0, the latest alert will overlay above the previous ones if multiple alerts visible on same edge; and when atScreenEdge=0, latest alert will show below previous visible ones without overlap.\n * fadeInDuration - a number in seconds specifying the fade in duration of the alert, defaults to 0.15\n * fadeOutDuration - a number in seconds specifying the fade out duration of the alert, defaults to 0.15\n\nIf you modify these values directly, it will affect all future alerts generated by this module. To adjust one of these properties for a single alert, use the optional `style` argument to the [hs.alert.show](#show) function.",
"file": "extensions/alert/alert.lua",
"lineno": "17",
"name": "defaultStyle",
"signature": "hs.alert.defaultStyle[]",
"stripped_doc": "The following may be specified in this table (any other key is ignored):\n * Keys which affect the alert rectangle:\n * fillColor - a table as defined by the `hs.drawing.color` module to specify the background color for the alert, defaults to { white = 0, alpha = 0.75 }.\n * strokeColor - a table as defined by the `hs.drawing.color` module to specify the outline color for the alert, defaults to { white = 1, alpha = 1 }.\n * strokeWidth - a number specifying the width of the outline for the alert, defaults to 2\n * radius - a number specifying the radius used for the rounded corners of the alert box, defaults to 27\n * Keys which affect the text of the alert when the message is a string (note that these keys will be ignored if the message being displayed is already an `hs.styledtext` object):\n * textColor - a table as defined by the `hs.drawing.color` module to specify the message text color for the alert, defaults to { white = 1, alpha = 1 }.\n * textFont - a string specifying the font to be used for the alert text, defaults to \".AppleSystemUIFont\" which is a symbolic name representing the systems default user interface font.\n * textSize - a number specifying the font size to be used for the alert text, defaults to 27.\n * textStyle - an optional table, defaults to `nil`, specifying that a string message should be converted to an `hs.styledtext` object using the style elements specified in this table. This table should conform to the key-value pairs as described in the documentation for the `hs.styledtext` module. If this table does not contain a `font` key-value pair, one will be constructed from the `textFont` and `textSize` keys (or their defaults); likewise, if this table does not contain a `color` key-value pair, one will be constructed from the `textColor` key (or its default).\n * padding - the number of pixels to reserve around each side of the text and/or image, defaults to textSize/2\n * atScreenEdge - 0: screen center (default); 1: top edge; 2: bottom edge . Note when atScreenEdge>0, the latest alert will overlay above the previous ones if multiple alerts visible on same edge; and when atScreenEdge=0, latest alert will show below previous visible ones without overlap.\n * fadeInDuration - a number in seconds specifying the fade in duration of the alert, defaults to 0.15\n * fadeOutDuration - a number in seconds specifying the fade out duration of the alert, defaults to 0.15\nIf you modify these values directly, it will affect all future alerts generated by this module. To adjust one of these properties for a single alert, use the optional `style` argument to the [hs.alert.show](#show) function.",
"type": "Variable"
},
{
"def": "hs.alert.show(str, [style], [screen], [seconds]) -> uuid",
"desc": "Shows a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.",
"doc": "Shows a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.\n\nParameters:\n * str - The string or `hs.styledtext` object to display in the alert\n * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.\n * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.\n * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately.\n\nReturns:\n * a string identifier for the alert.\n\nNotes:\n * For convenience, you can call this function as `hs.alert(...)`\n * This function effectively calls `hs.alert.showWithImage(msg, nil, ...)`. As such, all the same rules apply regarding argument processing",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "263",
"name": "show",
"notes": [
" * For convenience, you can call this function as `hs.alert(...)`",
" * This function effectively calls `hs.alert.showWithImage(msg, nil, ...)`. As such, all the same rules apply regarding argument processing"
],
"parameters": [
" * str - The string or `hs.styledtext` object to display in the alert",
" * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.",
" * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.",
" * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately."
],
"returns": [
" * a string identifier for the alert."
],
"signature": "hs.alert.show(str, [style], [screen], [seconds]) -> uuid",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.alert.showWithImage(str, image, [style], [screen], [seconds]) -> uuid",
"desc": "Shows an image and a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.",
"doc": "Shows an image and a message in large words briefly in the middle of the screen; does tostring() on its argument for convenience.\n\nParameters:\n * str - The string or `hs.styledtext` object to display in the alert\n * image - The image to display in the alert\n * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.\n * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.\n * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately.\n\nReturns:\n * a string identifier for the alert.\n\nNotes:\n * The optional parameters are parsed in the order presented as follows:\n * if the argument is a table and `style` has not previously been set, then the table is assigned to `style`\n * if the argument is a userdata and `screen` has not previously been set, then the userdata is assigned to `screen`\n * if `duration` has not been set, then it is assigned the value of the argument\n * if all of these conditions fail for a given argument, then an error is returned\n * The reason for this logic is to support the creation of persistent alerts as was previously handled by the module: If you specify a non-number value for `seconds` you will need to store the string identifier returned by this function so that you can close it manually with `hs.alert.closeSpecific` when the alert should be removed.\n * Any style element which is not specified in the `style` argument table will use the value currently defined in the [hs.alert.defaultStyle](#defaultStyle) table.",
"examples": [],
"file": "extensions/alert/alert.lua",
"lineno": "220",
"name": "showWithImage",
"notes": [
" * The optional parameters are parsed in the order presented as follows:",
" * if the argument is a table and `style` has not previously been set, then the table is assigned to `style`",
" * if the argument is a userdata and `screen` has not previously been set, then the userdata is assigned to `screen`",
" * if `duration` has not been set, then it is assigned the value of the argument",
" * if all of these conditions fail for a given argument, then an error is returned",
" * The reason for this logic is to support the creation of persistent alerts as was previously handled by the module: If you specify a non-number value for `seconds` you will need to store the string identifier returned by this function so that you can close it manually with `hs.alert.closeSpecific` when the alert should be removed.",
" * Any style element which is not specified in the `style` argument table will use the value currently defined in the [hs.alert.defaultStyle](#defaultStyle) table."
],
"parameters": [
" * str - The string or `hs.styledtext` object to display in the alert",
" * image - The image to display in the alert",
" * style - an optional table containing one or more of the keys specified in [hs.alert.defaultStyle](#defaultStyle). If `str` is already an `hs.styledtext` object, this argument is ignored.",
" * screen - an optional `hs.screen` userdata object specifying the screen (monitor) to display the alert on. Defaults to `hs.screen.mainScreen()` which corresponds to the screen with the currently focused window.",
" * seconds - The number of seconds to display the alert. Defaults to 2. If seconds is specified and is not a number, displays the alert indefinately."
],
"returns": [
" * a string identifier for the alert."
],
"signature": "hs.alert.showWithImage(str, image, [style], [screen], [seconds]) -> uuid",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.alert",
"stripped_doc": "",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.appfinder.appFromName(name) -> app or nil",
"desc": "Finds an application by its name (e.g. \"Safari\")",
"doc": "Finds an application by its name (e.g. \"Safari\")\n\nParameters:\n * name - A string containing the name of the application to search for\n\nReturns:\n * An hs.application object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "12",
"name": "appFromName",
"notes": [],
"parameters": [
" * name - A string containing the name of the application to search for"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.appFromName(name) -> app or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.appFromWindowTitle(title) -> app or nil",
"desc": "Finds an application by its window title (e.g. \"Activity Monitor (All Processes)\")",
"doc": "Finds an application by its window title (e.g. \"Activity Monitor (All Processes)\")\n\nParameters:\n * title - A string containing a window title of the application to search for\n\nReturns:\n * An hs.application object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "23",
"name": "appFromWindowTitle",
"notes": [],
"parameters": [
" * title - A string containing a window title of the application to search for"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.appFromWindowTitle(title) -> app or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.appFromWindowTitlePattern(pattern) -> app or nil",
"desc": "Finds an application by Lua pattern in its window title (e.g.\"Inbox %(%d+ messages.*)\")",
"doc": "Finds an application by Lua pattern in its window title (e.g.\"Inbox %(%d+ messages.*)\")\n\nParameters:\n * pattern - a Lua pattern describing a window title of the application to search for\n\nReturns:\n * An hs.application object if one can be found, otherwise nil\n\nNotes:\n * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "36",
"name": "appFromWindowTitlePattern",
"notes": [
" * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1"
],
"parameters": [
" * pattern - a Lua pattern describing a window title of the application to search for"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.appFromWindowTitlePattern(pattern) -> app or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.windowFromWindowTitle(title) -> win or nil",
"desc": "Finds a window by its title (e.g. \"Activity Monitor (All Processes)\")",
"doc": "Finds a window by its title (e.g. \"Activity Monitor (All Processes)\")\n\nParameters:\n * title - A string containing the title of the window to search for\n\nReturns:\n * An hs.window object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "52",
"name": "windowFromWindowTitle",
"notes": [],
"parameters": [
" * title - A string containing the title of the window to search for"
],
"returns": [
" * An hs.window object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.windowFromWindowTitle(title) -> win or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.windowFromWindowTitlePattern(pattern) -> app or nil",
"desc": "Finds a window by Lua pattern in its title (e.g.\"Inbox %(%d+ messages.*)\")",
"doc": "Finds a window by Lua pattern in its title (e.g.\"Inbox %(%d+ messages.*)\")\n\nParameters:\n * pattern - a Lua pattern describing a window title of the window to search for\n\nReturns:\n * An hs.window object if one can be found, otherwise nil\n\nNotes:\n * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "63",
"name": "windowFromWindowTitlePattern",
"notes": [
" * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1"
],
"parameters": [
" * pattern - a Lua pattern describing a window title of the window to search for"
],
"returns": [
" * An hs.window object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.windowFromWindowTitlePattern(pattern) -> app or nil",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "Easily find `hs.application` and `hs.window` objects",
"doc": "Easily find `hs.application` and `hs.window` objects\n\nThis module is *deprecated*; you can use `hs.window.find()`, `hs.window.get()`, `hs.application.find()`,\n`hs.application.get()`, `hs.application:findWindow()` and `hs.application:getWindow()` instead.",
"items": [
{
"def": "hs.appfinder.appFromName(name) -> app or nil",
"desc": "Finds an application by its name (e.g. \"Safari\")",
"doc": "Finds an application by its name (e.g. \"Safari\")\n\nParameters:\n * name - A string containing the name of the application to search for\n\nReturns:\n * An hs.application object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "12",
"name": "appFromName",
"notes": [],
"parameters": [
" * name - A string containing the name of the application to search for"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.appFromName(name) -> app or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.appFromWindowTitle(title) -> app or nil",
"desc": "Finds an application by its window title (e.g. \"Activity Monitor (All Processes)\")",
"doc": "Finds an application by its window title (e.g. \"Activity Monitor (All Processes)\")\n\nParameters:\n * title - A string containing a window title of the application to search for\n\nReturns:\n * An hs.application object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "23",
"name": "appFromWindowTitle",
"notes": [],
"parameters": [
" * title - A string containing a window title of the application to search for"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.appFromWindowTitle(title) -> app or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.appFromWindowTitlePattern(pattern) -> app or nil",
"desc": "Finds an application by Lua pattern in its window title (e.g.\"Inbox %(%d+ messages.*)\")",
"doc": "Finds an application by Lua pattern in its window title (e.g.\"Inbox %(%d+ messages.*)\")\n\nParameters:\n * pattern - a Lua pattern describing a window title of the application to search for\n\nReturns:\n * An hs.application object if one can be found, otherwise nil\n\nNotes:\n * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "36",
"name": "appFromWindowTitlePattern",
"notes": [
" * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1"
],
"parameters": [
" * pattern - a Lua pattern describing a window title of the application to search for"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.appFromWindowTitlePattern(pattern) -> app or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.windowFromWindowTitle(title) -> win or nil",
"desc": "Finds a window by its title (e.g. \"Activity Monitor (All Processes)\")",
"doc": "Finds a window by its title (e.g. \"Activity Monitor (All Processes)\")\n\nParameters:\n * title - A string containing the title of the window to search for\n\nReturns:\n * An hs.window object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "52",
"name": "windowFromWindowTitle",
"notes": [],
"parameters": [
" * title - A string containing the title of the window to search for"
],
"returns": [
" * An hs.window object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.windowFromWindowTitle(title) -> win or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.appfinder.windowFromWindowTitlePattern(pattern) -> app or nil",
"desc": "Finds a window by Lua pattern in its title (e.g.\"Inbox %(%d+ messages.*)\")",
"doc": "Finds a window by Lua pattern in its title (e.g.\"Inbox %(%d+ messages.*)\")\n\nParameters:\n * pattern - a Lua pattern describing a window title of the window to search for\n\nReturns:\n * An hs.window object if one can be found, otherwise nil\n\nNotes:\n * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1",
"examples": [],
"file": "extensions/appfinder/appfinder.lua",
"lineno": "63",
"name": "windowFromWindowTitlePattern",
"notes": [
" * For more about Lua patterns, see http://lua-users.org/wiki/PatternsTutorial and http://www.lua.org/manual/5.2/manual.html#6.4.1"
],
"parameters": [
" * pattern - a Lua pattern describing a window title of the window to search for"
],
"returns": [
" * An hs.window object if one can be found, otherwise nil"
],
"signature": "hs.appfinder.windowFromWindowTitlePattern(pattern) -> app or nil",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.appfinder",
"stripped_doc": "\nThis module is *deprecated*; you can use `hs.window.find()`, `hs.window.get()`, `hs.application.find()`,\n`hs.application.get()`, `hs.application:findWindow()` and `hs.application:getWindow()` instead.",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [],
"Variable": [],
"desc": "Execute AppleScript code",
"doc": "Execute AppleScript code\n\nThis module has been replaced by: [hs.osascript.applescript](./hs.osascript.html#applescript)",
"items": [],
"name": "hs.applescript",
"stripped_doc": "\nThis module has been replaced by: [hs.osascript.applescript](./hs.osascript.html#applescript)",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [
{
"def": "hs.application.find(hint) -> hs.application object(s)",
"desc": "Finds running applications",
"doc": "Finds running applications\n\nParameters:\n * hint - search criterion for the desired application(s); it can be:\n - a pid number as per `hs.application:pid()`\n - a bundle ID string as per `hs.application:bundleID()`\n - a string pattern that matches (via `string.find`) the application name as per `hs.application:name()` (for convenience, the matching will be done on lowercased strings)\n - a string pattern that matches (via `string.find`) the application's window title per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)\n\nReturns:\n * one or more hs.application objects for running applications that match the supplied search criterion, or `nil` if none found\n\nNotes:\n * If multiple results are found, this function will return multiple values. See [https://www.lua.org/pil/5.1.html](https://www.lua.org/pil/5.1.html) for more information on how to work with this\n * for convenience you can call this as `hs.application(hint)`\n * use this function when you don't know the exact name of an application you're interested in, i.e.\n from the console: `hs.application'term' --> hs.application: iTerm2 (0x61000025fb88) hs.application: Terminal (0x618000447588)`.\n But be careful when using it in your `init.lua`: `terminal=hs.application'term'` will assign either \"Terminal\" or \"iTerm2\" arbitrarily (or even,\n if neither are running, any other app with a window that happens to have \"term\" in its title); to make sure you get the right app in your scripts,\n use `hs.application.get` with the exact name: `terminal=hs.application.get'Terminal' --> \"Terminal\" app, or nil if it's not running`\n\nUsage:\n-- by pid\nhs.application(42):name() --> Finder\n-- by bundle id\nhs.application'com.apple.Safari':name() --> Safari\n-- by name\nhs.application'chrome':name() --> Google Chrome\n-- by window title\nhs.application'bash':name() --> Terminal",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "106",
"name": "find",
"notes": [
" * If multiple results are found, this function will return multiple values. See [https://www.lua.org/pil/5.1.html](https://www.lua.org/pil/5.1.html) for more information on how to work with this",
" * for convenience you can call this as `hs.application(hint)`",
" * use this function when you don't know the exact name of an application you're interested in, i.e.",
" from the console: `hs.application'term' --> hs.application: iTerm2 (0x61000025fb88) hs.application: Terminal (0x618000447588)`.",
" But be careful when using it in your `init.lua`: `terminal=hs.application'term'` will assign either \"Terminal\" or \"iTerm2\" arbitrarily (or even,",
" if neither are running, any other app with a window that happens to have \"term\" in its title); to make sure you get the right app in your scripts,",
" use `hs.application.get` with the exact name: `terminal=hs.application.get'Terminal' --> \"Terminal\" app, or nil if it's not running`",
"",
"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"
],
"parameters": [
" * hint - search criterion for the desired application(s); it can be: - a pid number as per `hs.application:pid()` - a bundle ID string as per `hs.application:bundleID()` - a string pattern that matches (via `string.find`) the application name as per `hs.application:name()` (for convenience, the matching will be done on lowercased strings) - a string pattern that matches (via `string.find`) the application's window title per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)"
],
"returns": [
" * one or more hs.application objects for running applications that match the supplied search criterion, or `nil` if none found"
],
"signature": "hs.application.find(hint) -> hs.application object(s)",
"stripped_doc": "Usage:\n-- by pid\nhs.application(42):name() --> Finder\n-- by bundle id\nhs.application'com.apple.Safari':name() --> Safari\n-- by name\nhs.application'chrome':name() --> Google Chrome\n-- by window title\nhs.application'bash':name() --> Terminal",
"type": "Constructor"
},
{
"def": "hs.application.get(hint) -> hs.application object",
"desc": "Gets a running application",
"doc": "Gets a running application\n\nParameters:\n * hint - search criterion for the desired application; it can be:\n - a pid number as per `hs.application:pid()`\n - a bundle ID string as per `hs.application:bundleID()`\n - an application name string as per `hs.application:name()`\n\nReturns:\n * an hs.application object for a running application that matches the supplied search criterion, or `nil` if not found\n\nNotes:\n * see also `hs.application.find`",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "87",
"name": "get",
"notes": [
" * see also `hs.application.find`"
],
"parameters": [
" * hint - search criterion for the desired application; it can be: - a pid number as per `hs.application:pid()` - a bundle ID string as per `hs.application:bundleID()` - an application name string as per `hs.application:name()`"
],
"returns": [
" * an hs.application object for a running application that matches the supplied search criterion, or `nil` if not found"
],
"signature": "hs.application.get(hint) -> hs.application object",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.application.open(app[, wait, [waitForFirstWindow]]) -> hs.application object",
"desc": "Launches an application, or activates it if it's already running",
"doc": "Launches an application, or activates it if it's already running\n\nParameters:\n * app - a string describing the application to open; it can be:\n - the application's name as per `hs.application:name()`\n - the full path to an application on disk (including the `.app` suffix)\n - the application's bundle ID as per `hs.application:bundleID()`\n * wait - (optional) the maximum number of seconds to wait for the app to be launched, if not already running; if omitted, defaults to 0;\n if the app takes longer than this to launch, this function will return `nil`, but the app will still launch\n * waitForFirstWindow - (optional) if `true`, additionally wait until the app has spawned its first window (which usually takes a bit longer)\n\nReturns:\n * the `hs.application` object for the launched or activated application; `nil` if not found\n\nNotes:\n * the `wait` parameter will *block all Hammerspoon activity* in order to return the application object \"synchronously\"; only use it if you\n a) have no time-critical event processing happening elsewhere in your `init.lua` and b) need to act on the application object, or on\n its window(s), right away\n * when launching a \"windowless\" app (background daemon, menulet, etc.) make sure to omit `waitForFirstWindow`",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "200",
"name": "open",
"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`"
],
"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"
],
"signature": "hs.application.open(app[, wait, [waitForFirstWindow]]) -> hs.application object",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.application.applicationForPID(pid) -> hs.application object or nil",
"desc": "Returns the running app for the given pid, if it exists.",
"doc": "Returns the running app for the given pid, if it exists.\n\nParameters:\n * pid - a UNIX process id (i.e. a number)\n\nReturns:\n * An hs.application object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "54",
"name": "applicationForPID",
"notes": [],
"parameters": [
" * pid - a UNIX process id (i.e. a number)"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.application.applicationForPID(pid) -> hs.application object or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.applicationsForBundleID(bundleID) -> list of hs.application objects",
"desc": "Returns any running apps that have the given bundleID.",
"doc": "Returns any running apps that have the given bundleID.\n\nParameters:\n * bundleID - An OSX application bundle indentifier\n\nReturns:\n * A table of zero or more hs.application objects that match the given identifier",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "71",
"name": "applicationsForBundleID",
"notes": [],
"parameters": [
" * bundleID - An OSX application bundle indentifier"
],
"returns": [
" * A table of zero or more hs.application objects that match the given identifier"
],
"signature": "hs.application.applicationsForBundleID(bundleID) -> list of hs.application objects",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.defaultAppForUTI(uti) -> string or nil",
"desc": "Returns the bundle ID of the default application for a given UTI",
"doc": "Returns the bundle ID of the default application for a given UTI\n\nParameters:\n * uti - A string containing a UTI\n\nReturns:\n * A string containing a bundle ID, or nil if none could be found",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "151",
"name": "defaultAppForUTI",
"notes": [],
"parameters": [
" * uti - A string containing a UTI"
],
"returns": [
" * A string containing a bundle ID, or nil if none could be found"
],
"signature": "hs.application.defaultAppForUTI(uti) -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.enableSpotlightForNameSearches([state]) -> boolean",
"desc": "Get or set whether Spotlight should be used to find alternate names for applications.",
"doc": "Get or set whether Spotlight should be used to find alternate names for applications.\n\nParameters:\n * `state` - an optional boolean specifying whether or not Spotlight should be used to try and determine alternate application names for `hs.application.find` and similar functions.\n\nReturns:\n * the current, possibly changed, state\n\nNotes:\n * This setting is persistent across reloading and restarting Hammerspoon.\n * If this was set to true and you set it to true again, it will purge the alternate name map and rebuild it from scratch.\n * You can disable Spotlight alternate name mapping by setting this value to false or nil. If you set this to false, then the notifications indicating that more results might be possible if Spotlight is enabled will be suppressed.",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "427",
"name": "enableSpotlightForNameSearches",
"notes": [
" * This setting is persistent across reloading and restarting Hammerspoon.",
" * If this was set to true and you set it to true again, it will purge the alternate name map and rebuild it from scratch.",
" * You can disable Spotlight alternate name mapping by setting this value to false or nil. If you set this to false, then the notifications indicating that more results might be possible if Spotlight is enabled will be suppressed."
],
"parameters": [
" * `state` - an optional boolean specifying whether or not Spotlight should be used to try and determine alternate application names for `hs.application.find` and similar functions."
],
"returns": [
" * the current, possibly changed, state"
],
"signature": "hs.application.enableSpotlightForNameSearches([state]) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.frontmostApplication() -> hs.application object",
"desc": "Returns the application object for the frontmost (active) application. This is the application which currently receives input events.",
"doc": "Returns the application object for the frontmost (active) application. This is the application which currently receives input events.\n\nParameters:\n * None\n\nReturns:\n * An hs.application object",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "21",
"name": "frontmostApplication",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.application object"
],
"signature": "hs.application.frontmostApplication() -> hs.application object",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.infoForBundleID(bundleID) -> table or nil",
"desc": "Gets the metadata of an application from its bundle identifier",
"doc": "Gets the metadata of an application from its bundle identifier\n\nParameters:\n * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")\n\nReturns:\n * A table containing information about the application, or nil if the bundle identifier could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "119",
"name": "infoForBundleID",
"notes": [],
"parameters": [
" * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")"
],
"returns": [
" * A table containing information about the application, or nil if the bundle identifier could not be located"
],
"signature": "hs.application.infoForBundleID(bundleID) -> table or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.infoForBundlePath(bundlePath) -> table or nil",
"desc": "Gets the metadata of an application from its path on disk",
"doc": "Gets the metadata of an application from its path on disk\n\nParameters:\n * bundlePath - A string containing the path to an application bundle (e.g. \"/Applications/Safari.app\")\n\nReturns:\n * A table containing information about the application, or nil if the bundle could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "135",
"name": "infoForBundlePath",
"notes": [],
"parameters": [
" * bundlePath - A string containing the path to an application bundle (e.g. \"/Applications/Safari.app\")"
],
"returns": [
" * A table containing information about the application, or nil if the bundle could not be located"
],
"signature": "hs.application.infoForBundlePath(bundlePath) -> table or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.launchOrFocus(name) -> boolean",
"desc": "Launches the app with the given name, or activates it if it's already running",
"doc": "Launches the app with the given name, or activates it if it's already running\n\nParameters:\n * name - A string containing the name of the application to either launch or focus. This can also be the full path to an application (including the `.app` suffix) if you need to uniquely distinguish between applications in different locations that share the same name\n\nReturns:\n * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)\n\nNotes:\n * The name parameter should match the name of the application on disk, e.g. \"IntelliJ IDEA\", rather than \"IntelliJ\"",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "1028",
"name": "launchOrFocus",
"notes": [
" * The name parameter should match the name of the application on disk, e.g. \"IntelliJ IDEA\", rather than \"IntelliJ\""
],
"parameters": [
" * name - A string containing the name of the application to either launch or focus. This can also be the full path to an application (including the `.app` suffix) if you need to uniquely distinguish between applications in different locations that share the same name"
],
"returns": [
" * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)"
],
"signature": "hs.application.launchOrFocus(name) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.launchOrFocusByBundleID(bundleID) -> boolean",
"desc": "Launches the app with the given bundle ID, or activates it if it's already running",
"doc": "Launches the app with the given bundle ID, or activates it if it's already running\n\nParameters:\n * bundleID - A string containing the bundle ID of the application to either launch or focus.\n\nReturns:\n * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)\n\nNotes:\n * Bundle identifiers typically take the form of `com.company.ApplicationName`",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "1047",
"name": "launchOrFocusByBundleID",
"notes": [
" * Bundle identifiers typically take the form of `com.company.ApplicationName`"
],
"parameters": [
" * bundleID - A string containing the bundle ID of the application to either launch or focus."
],
"returns": [
" * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)"
],
"signature": "hs.application.launchOrFocusByBundleID(bundleID) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.nameForBundleID(bundleID) -> string or nil",
"desc": "Gets the name of an application from its bundle identifier",
"doc": "Gets the name of an application from its bundle identifier\n\nParameters:\n * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")\n\nReturns:\n * A string containing the application name, or nil if the bundle identifier could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "87",
"name": "nameForBundleID",
"notes": [],
"parameters": [
" * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")"
],
"returns": [
" * A string containing the application name, or nil if the bundle identifier could not be located"
],
"signature": "hs.application.nameForBundleID(bundleID) -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.pathForBundleID(bundleID) -> string or nil",
"desc": "Gets the filesystem path of an application from its bundle identifier",
"doc": "Gets the filesystem path of an application from its bundle identifier\n\nParameters:\n * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")\n\nReturns:\n * A string containing the app bundle's filesystem path, or nil if the bundle identifier could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "103",
"name": "pathForBundleID",
"notes": [],
"parameters": [
" * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")"
],
"returns": [
" * A string containing the app bundle's filesystem path, or nil if the bundle identifier could not be located"
],
"signature": "hs.application.pathForBundleID(bundleID) -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.runningApplications() -> list of hs.application objects",
"desc": "Returns all running apps.",
"doc": "Returns all running apps.\n\nParameters:\n * None\n\nReturns:\n * A table containing zero or more hs.application objects currently running on the system",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "37",
"name": "runningApplications",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing zero or more hs.application objects currently running on the system"
],
"signature": "hs.application.runningApplications() -> list of hs.application objects",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [
{
"def": "hs.application:activate([allWindows]) -> bool",
"desc": "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.",
"doc": "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.\n\nParameters:\n * allWindows - If true, all windows of the application will be brought to the front. Otherwise, only the application's key window will. Defaults to false.\n\nReturns:\n * A boolean value indicating whether or not the application could be activated",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "62",
"name": "activate",
"notes": [],
"parameters": [
" * allWindows - If true, all windows of the application will be brought to the front. Otherwise, only the application's key window will. Defaults to false."
],
"returns": [
" * A boolean value indicating whether or not the application could be activated"
],
"signature": "hs.application:activate([allWindows]) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:allWindows() -> list of hs.window objects",
"desc": "Returns all open windows owned by the given app.",
"doc": "Returns all open windows owned by the given app.\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more hs.window objects owned by the application\n\nNotes:\n * This function can only return windows in the current Mission Control Space; if you need to address windows across\n different Spaces you can use the `hs.window.filter` module\n - if `Displays have separate Spaces` is *on* (in System Preferences>Mission Control) the current Space is defined\n as the union of all currently visible Spaces\n - minimized windows and hidden windows (i.e. belonging to hidden apps, e.g. via cmd-h) are always considered\n to be in the current Space",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "182",
"name": "allWindows",
"notes": [
" * This function can only return windows in the current Mission Control Space; if you need to address windows across",
" different Spaces you can use the `hs.window.filter` module",
" - if `Displays have separate Spaces` is *on* (in System Preferences>Mission Control) the current Space is defined",
" as the union of all currently visible Spaces",
" - minimized windows and hidden windows (i.e. belonging to hidden apps, e.g. via cmd-h) are always considered",
" to be in the current Space"
],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more hs.window objects owned by the application"
],
"signature": "hs.application:allWindows() -> list of hs.window objects",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:bundleID() -> string",
"desc": "Returns the bundle identifier of the app.",
"doc": "Returns the bundle identifier of the app.\n\nParameters:\n * None\n\nReturns:\n * A string containing the bundle identifier of the application",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "285",
"name": "bundleID",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the bundle identifier of the application"
],
"signature": "hs.application:bundleID() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:findMenuItem(menuItem[, isRegex]) -> table or nil",
"desc": "Searches the application for a menu item",
"doc": "Searches the application for a menu item\n\nParameters:\n * menuItem - This can either be a string containing the text of a menu item (e.g. `\"Messages\"`) or a table representing the hierarchical path of a menu item (e.g. `{\"File\", \"Share\", \"Messages\"}`). In the string case, all of the application's menus will be searched until a match is found (with no specified behaviour if multiple menu items exist with the same name). In the table case, the whole menu structure will not be searched, because a precise path has been specified.\n * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against\n\nReturns:\n * Returns nil if the menu item cannot be found. If it does exist, returns a table with two keys:\n * enabled - whether the menu item can be selected/ticked. This will always be false if the application is not currently focussed\n * ticked - whether the menu item is ticked or not (obviously this value is meaningless for menu items that can't be ticked)\n\nNotes:\n * This can only search for menu items that don't have children - i.e. you can't search for the name of a submenu",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "700",
"name": "findMenuItem",
"notes": [
" * This can only search for menu items that don't have children - i.e. you can't search for the name of a submenu"
],
"parameters": [
" * menuItem - This can either be a string containing the text of a menu item (e.g. `\"Messages\"`) or a table representing the hierarchical path of a menu item (e.g. `{\"File\", \"Share\", \"Messages\"}`). In the string case, all of the application's menus will be searched until a match is found (with no specified behaviour if multiple menu items exist with the same name). In the table case, the whole menu structure will not be searched, because a precise path has been specified.",
" * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against"
],
"returns": [
" * Returns nil if the menu item cannot be found. If it does exist, returns a table with two keys:",
" * enabled - whether the menu item can be selected/ticked. This will always be false if the application is not currently focussed",
" * ticked - whether the menu item is ticked or not (obviously this value is meaningless for menu items that can't be ticked)"
],
"signature": "hs.application:findMenuItem(menuItem[, isRegex]) -> table or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:findWindow(titlePattern) -> hs.window object(s)",
"desc": "Finds windows from this application",
"doc": "Finds windows from this application\n\nParameters:\n * titlePattern - a string pattern that matches (via `string.find`) the window title(s) as per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)\n\nReturns:\n * one or more hs.window objects belonging to this application that match the supplied search criterion, or `nil` if none found",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "173",
"name": "findWindow",
"notes": [],
"parameters": [
" * titlePattern - a string pattern that matches (via `string.find`) the window title(s) as per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)"
],
"returns": [
" * one or more hs.window objects belonging to this application that match the supplied search criterion, or `nil` if none found"
],
"signature": "hs.application:findWindow(titlePattern) -> hs.window object(s)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:focusedWindow() -> hs.window object or nil",
"desc": "Returns the currently focused window of the application, or nil",
"doc": "Returns the currently focused window of the application, or nil\n\nParameters:\n * None\n\nReturns:\n * An hs.window object representing the window of the application that currently has focus, or nil if there are none",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "225",
"name": "focusedWindow",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.window object representing the window of the application that currently has focus, or nil if there are none"
],
"signature": "hs.application:focusedWindow() -> hs.window object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:getMenuItems([fn]) -> table or nil | hs.application object",
"desc": "Gets the menu structure of the application",
"doc": "Gets the menu structure of the application\n\nParameters:\n * fn - an optional callback function. If provided, the function will receive a single argument and return none.\n\nReturns:\n * If no argument is provided, returns a table containing the menu structure of the application, or nil if an error occurred. If a callback function is provided, the callback function will receive this table (or nil) and this method will return the application object this method was invoked on.\n\nNotes:\n * In some applications, this can take a little while to complete, because quite a large number of round trips are required to the source application, to get the information. When this method is invoked without a callback function, Hammerspoon will block while creating the menu structure table. When invoked with a callback function, the menu structure is built in a background thread.\n\n * The table is nested with the same structure as the menus of the application. Each item has several keys containing information about the menu item. Not all keys will appear for all items. The possible keys are:\n * AXTitle - A string containing the text of the menu item (entries which have no title are menu separators)\n * AXEnabled - A boolean, 1 if the menu item is clickable, 0 if not\n * AXRole - A string containing the role of the menu item - this will be either AXMenuBarItem for a top level menu, or AXMenuItem for an item in a menu\n * AXMenuItemMarkChar - A string containing the \"mark\" character for a menu item. This is for toggleable menu items and will usually be an empty string or a Unicode tick character (✓)\n * AXMenuItemCmdModifiers - A table containing string representations of the keyboard modifiers for the menu item's keyboard shortcut, or nil if no modifiers are present\n * AXMenuItemCmdChar - A string containing the key for the menu item's keyboard shortcut, or an empty string if no shortcut is present\n * AXMenuItemCmdGlyph - An integer, corresponding to one of the defined glyphs in `hs.application.menuGlyphs` if the keyboard shortcut is a special character usually represented by a pictorial representation (think arrow keys, return, etc), or an empty string if no glyph is used in presenting the keyboard shortcut.\n * Using `hs.inspect()` on these tables, while useful for exploration, can be extremely slow, taking several minutes to correctly render very complex menus",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "961",
"name": "getMenuItems",
"notes": [
" * In some applications, this can take a little while to complete, because quite a large number of round trips are required to the source application, to get the information. When this method is invoked without a callback function, Hammerspoon will block while creating the menu structure table. When invoked with a callback function, the menu structure is built in a background thread.",
"",
" * The table is nested with the same structure as the menus of the application. Each item has several keys containing information about the menu item. Not all keys will appear for all items. The possible keys are:",
" * AXTitle - A string containing the text of the menu item (entries which have no title are menu separators)",
" * AXEnabled - A boolean, 1 if the menu item is clickable, 0 if not",
" * AXRole - A string containing the role of the menu item - this will be either AXMenuBarItem for a top level menu, or AXMenuItem for an item in a menu",
" * AXMenuItemMarkChar - A string containing the \"mark\" character for a menu item. This is for toggleable menu items and will usually be an empty string or a Unicode tick character (✓)",
" * AXMenuItemCmdModifiers - A table containing string representations of the keyboard modifiers for the menu item's keyboard shortcut, or nil if no modifiers are present",
" * AXMenuItemCmdChar - A string containing the key for the menu item's keyboard shortcut, or an empty string if no shortcut is present",
" * AXMenuItemCmdGlyph - An integer, corresponding to one of the defined glyphs in `hs.application.menuGlyphs` if the keyboard shortcut is a special character usually represented by a pictorial representation (think arrow keys, return, etc), or an empty string if no glyph is used in presenting the keyboard shortcut.",
" * Using `hs.inspect()` on these tables, while useful for exploration, can be extremely slow, taking several minutes to correctly render very complex menus"
],
"parameters": [
" * fn - an optional callback function. If provided, the function will receive a single argument and return none."
],
"returns": [
" * If no argument is provided, returns a table containing the menu structure of the application, or nil if an error occurred. If a callback function is provided, the callback function will receive this table (or nil) and this method will return the application object this method was invoked on."
],
"signature": "hs.application:getMenuItems([fn]) -> table or nil | hs.application object",
"stripped_doc": " * The table is nested with the same structure as the menus of the application. Each item has several keys containing information about the menu item. Not all keys will appear for all items. The possible keys are:\n * AXTitle - A string containing the text of the menu item (entries which have no title are menu separators)\n * AXEnabled - A boolean, 1 if the menu item is clickable, 0 if not\n * AXRole - A string containing the role of the menu item - this will be either AXMenuBarItem for a top level menu, or AXMenuItem for an item in a menu\n * AXMenuItemMarkChar - A string containing the \"mark\" character for a menu item. This is for toggleable menu items and will usually be an empty string or a Unicode tick character (✓)\n * AXMenuItemCmdModifiers - A table containing string representations of the keyboard modifiers for the menu item's keyboard shortcut, or nil if no modifiers are present\n * AXMenuItemCmdChar - A string containing the key for the menu item's keyboard shortcut, or an empty string if no shortcut is present\n * AXMenuItemCmdGlyph - An integer, corresponding to one of the defined glyphs in `hs.application.menuGlyphs` if the keyboard shortcut is a special character usually represented by a pictorial representation (think arrow keys, return, etc), or an empty string if no glyph is used in presenting the keyboard shortcut.\n * Using `hs.inspect()` on these tables, while useful for exploration, can be extremely slow, taking several minutes to correctly render very complex menus",
"type": "Method"
},
{
"def": "hs.application:getWindow(title) -> hs.window object",
"desc": "Gets a specific window from this application",
"doc": "Gets a specific window from this application\n\nParameters:\n * title - the desired window's title string as per `hs.window:title()`\n\nReturns:\n * the desired hs.window object belonging to this application, or `nil` if not found",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "187",
"name": "getWindow",
"notes": [],
"parameters": [
" * title - the desired window's title string as per `hs.window:title()`"
],
"returns": [
" * the desired hs.window object belonging to this application, or `nil` if not found"
],
"signature": "hs.application:getWindow(title) -> hs.window object",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:hide() -> boolean",
"desc": "Hides the app (and all its windows).",
"doc": "Hides the app (and all its windows).\n\nParameters:\n * None\n\nReturns:\n * A boolean indicating whether the application was successfully hidden",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "357",
"name": "hide",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean indicating whether the application was successfully hidden"
],
"signature": "hs.application:hide() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:isFrontmost() -> boolean",
"desc": "Returns whether the app is the frontmost (i.e. is the currently active application)",
"doc": "Returns whether the app is the frontmost (i.e. is the currently active application)\n\nParameters:\n * None\n\nReturns:\n * True if the application is the frontmost application, otherwise false",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "426",
"name": "isFrontmost",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the application is the frontmost application, otherwise false"
],
"signature": "hs.application:isFrontmost() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:isHidden() -> boolean",
"desc": "Returns whether the app is currently hidden.",
"doc": "Returns whether the app is currently hidden.\n\nParameters:\n * None\n\nReturns:\n * A boolean indicating whether the application is hidden or not",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "409",
"name": "isHidden",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean indicating whether the application is hidden or not"
],
"signature": "hs.application:isHidden() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:isRunning() -> boolean",
"desc": "Checks if the application is still running",
"doc": "Checks if the application is still running\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the application is running, false if not\n\nNotes:\n * If an application is terminated and re-launched, this method will still return false, as `hs.application` objects are tied to a specific instance of an application (i.e. its PID)",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "319",
"name": "isRunning",
"notes": [
" * If an application is terminated and re-launched, this method will still return false, as `hs.application` objects are tied to a specific instance of an application (i.e. its PID)"
],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the application is running, false if not"
],
"signature": "hs.application:isRunning() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:kill()",
"desc": "Tries to terminate the app gracefully.",
"doc": "Tries to terminate the app gracefully.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "375",
"name": "kill",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.application:kill()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:kill9()",
"desc": "Tries to terminate the app forcefully.",
"doc": "Tries to terminate the app forcefully.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "392",
"name": "kill9",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.application:kill9()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:kind() -> number",
"desc": "Identify the application's GUI state",
"doc": "Identify the application's GUI state\n\nParameters:\n * None\n\nReturns:\n * A number that is either 1 if the app is in the dock, 0 if it is not, or -1 if the application is prohibited from having GUI elements",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "483",
"name": "kind",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number that is either 1 if the app is in the dock, 0 if it is not, or -1 if the application is prohibited from having GUI elements"
],
"signature": "hs.application:kind() -> number",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:mainWindow() -> hs.window object or nil",
"desc": "Returns the main window of the given app, or nil.",
"doc": "Returns the main window of the given app, or nil.\n\nParameters:\n * None\n\nReturns:\n * An hs.window object representing the main window of the application, or nil if it has no windows",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "208",
"name": "mainWindow",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.window object representing the main window of the application, or nil if it has no windows"
],
"signature": "hs.application:mainWindow() -> hs.window object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:name()",
"desc": "Alias for [`hs.application:title()`](#title)",
"doc": "Alias for [`hs.application:title()`](#title)",
"file": "extensions/application/application.lua",
"lineno": "82",
"name": "name",
"notes": [],
"parameters": [],
"returns": [],
"signature": "hs.application:name()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:path() -> string",
"desc": "Returns the filesystem path of the app.",
"doc": "Returns the filesystem path of the app.\n\nParameters:\n * None\n\nReturns:\n * A string containing the filesystem path of the application or nil if the path could not be determined (e.g. if the application has terminated).",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "302",
"name": "path",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the filesystem path of the application or nil if the path could not be determined (e.g. if the application has terminated)."
],
"signature": "hs.application:path() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:pid() -> number",
"desc": "Returns the app's process identifier.",
"doc": "Returns the app's process identifier.\n\nParameters:\n * None\n\nReturns:\n * The UNIX process identifier of the application (i.e. a number)",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "466",
"name": "pid",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The UNIX process identifier of the application (i.e. a number)"
],
"signature": "hs.application:pid() -> number",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:selectMenuItem(menuitem[, isRegex]) -> true or nil",
"desc": "Selects a menu item (i.e. simulates clicking on the menu item)",
"doc": "Selects a menu item (i.e. simulates clicking on the menu item)\n\nParameters:\n * menuitem - The menu item to select, specified as either a string or a table. See the `menuitem` parameter of `hs.application:findMenuItem()` for more information.\n * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against\n\nReturns:\n * True if the menu item was found and selected, or nil if it wasn't (e.g. because the menu item couldn't be found)\n\nNotes:\n * Depending on the type of menu item involved, this will either activate or tick/untick the menu item",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "791",
"name": "selectMenuItem",
"notes": [
" * Depending on the type of menu item involved, this will either activate or tick/untick the menu item"
],
"parameters": [
" * menuitem - The menu item to select, specified as either a string or a table. See the `menuitem` parameter of `hs.application:findMenuItem()` for more information.",
" * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against"
],
"returns": [
" * True if the menu item was found and selected, or nil if it wasn't (e.g. because the menu item couldn't be found)"
],
"signature": "hs.application:selectMenuItem(menuitem[, isRegex]) -> true or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:setFrontmost([allWindows]) -> boolean",
"desc": "Sets the app to the frontmost (i.e. currently active) application",
"doc": "Sets the app to the frontmost (i.e. currently active) application\n\nParameters:\n * allWindows - An optional boolean, true to bring all windows of the application to the front. Defaults to false\n\nReturns:\n * A boolean, true if the operation was successful, otherwise false",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "443",
"name": "setFrontmost",
"notes": [],
"parameters": [
" * allWindows - An optional boolean, true to bring all windows of the application to the front. Defaults to false"
],
"returns": [
" * A boolean, true if the operation was successful, otherwise false"
],
"signature": "hs.application:setFrontmost([allWindows]) -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:title() -> string",
"desc": "Returns the localized name of the app (in UTF8).",
"doc": "Returns the localized name of the app (in UTF8).\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the application",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "268",
"name": "title",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the application"
],
"signature": "hs.application:title() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:unhide() -> boolean",
"desc": "Unhides the app (and all its windows) if it's hidden.",
"doc": "Unhides the app (and all its windows) if it's hidden.\n\nParameters:\n * None\n\nReturns:\n * A boolean indicating whether the application was successfully unhidden",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "339",
"name": "unhide",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean indicating whether the application was successfully unhidden"
],
"signature": "hs.application:unhide() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:visibleWindows() -> win[]",
"desc": "Returns only the app's windows that are visible.",
"doc": "Returns only the app's windows that are visible.\n\nParameters:\n * None\n\nReturns:\n * A table containing zero or more hs.window objects",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "46",
"name": "visibleWindows",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing zero or more hs.window objects"
],
"signature": "hs.application:visibleWindows() -> win[]",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [
{
"def": "hs.application.menuGlyphs",
"desc": "A table containing UTF8 representations of the defined key glyphs used in Menus for keybaord shortcuts which are presented pictorially rather than as text (arrow keys, return key, etc.)",
"doc": "A table containing UTF8 representations of the defined key glyphs used in Menus for keybaord shortcuts which are presented pictorially rather than as text (arrow keys, return key, etc.)\n\nThese glyphs are indexed numerically where the numeric index matches a possible value for the AXMenuItemCmdGlyph key of an entry returned by `hs.application.getMenus`. If the AXMenuItemCmdGlyph field is non-numeric, then no glyph is used in the presentation of the keyboard shortcut for a menu item.\n\nThe following glyphs are defined:\n * \"⇥\", -- kMenuTabRightGlyph, 0x02, Tab to the right key (for left-to-right script systems)\n * \"⇤\", -- kMenuTabLeftGlyph, 0x03, Tab to the left key (for right-to-left script systems)\n * \"⌤\", -- kMenuEnterGlyph, 0x04, Enter key\n * \"⇧\", -- kMenuShiftGlyph, 0x05, Shift key\n * \"⌃\", -- kMenuControlGlyph, 0x06, Control key\n * \"⌥\", -- kMenuOptionGlyph, 0x07, Option key\n * \"␣\", -- kMenuSpaceGlyph, 0x09, Space (always glyph 3) key\n * \"⌦\", -- kMenuDeleteRightGlyph, 0x0A, Delete to the right key (for right-to-left script systems)\n * \"↩\", -- kMenuReturnGlyph, 0x0B, Return key (for left-to-right script systems)\n * \"↪\", -- kMenuReturnR2LGlyph, 0x0C, Return key (for right-to-left script systems)\n * \"\", -- kMenuPencilGlyph, 0x0F, Pencil key\n * \"↓\", -- kMenuDownwardArrowDashedGlyph, 0x10, Downward dashed arrow key\n * \"⌘\", -- kMenuCommandGlyph, 0x11, Command key\n * \"✓\", -- kMenuCheckmarkGlyph, 0x12, Checkmark key\n * \"⃟\", -- kMenuDiamondGlyph, 0x13, Diamond key\n * \"\", -- kMenuAppleLogoFilledGlyph, 0x14, Apple logo key (filled)\n * \"⌫\", -- kMenuDeleteLeftGlyph, 0x17, Delete to the left key (for left-to-right script systems)\n * \"←\", -- kMenuLeftArrowDashedGlyph, 0x18, Leftward dashed arrow key\n * \"↑\", -- kMenuUpArrowDashedGlyph, 0x19, Upward dashed arrow key\n * \"→\", -- kMenuRightArrowDashedGlyph, 0x1A, Rightward dashed arrow key\n * \"⎋\", -- kMenuEscapeGlyph, 0x1B, Escape key\n * \"⌧\", -- kMenuClearGlyph, 0x1C, Clear key\n * \"『\", -- kMenuLeftDoubleQuotesJapaneseGlyph, 0x1D, Unassigned (left double quotes in Japanese)\n * \"』\", -- kMenuRightDoubleQuotesJapaneseGlyph, 0x1E, Unassigned (right double quotes in Japanese)\n * \"␢\", -- kMenuBlankGlyph, 0x61, Blank key\n * \"⇞\", -- kMenuPageUpGlyph, 0x62, Page up key\n * \"⇪\", -- kMenuCapsLockGlyph, 0x63, Caps lock key\n * \"←\", -- kMenuLeftArrowGlyph, 0x64, Left arrow key\n * \"→\", -- kMenuRightArrowGlyph, 0x65, Right arrow key\n * \"↖\", -- kMenuNorthwestArrowGlyph, 0x66, Northwest arrow key\n * \"﹖\", -- kMenuHelpGlyph, 0x67, Help key\n * \"↑\", -- kMenuUpArrowGlyph, 0x68, Up arrow key\n * \"↘\", -- kMenuSoutheastArrowGlyph, 0x69, Southeast arrow key\n * \"↓\", -- kMenuDownArrowGlyph, 0x6A, Down arrow key\n * \"⇟\", -- kMenuPageDownGlyph, 0x6B, Page down key\n * \"\", -- kMenuContextualMenuGlyph, 0x6D, Contextual menu key\n * \"⌽\", -- kMenuPowerGlyph, 0x6E, Power key\n * \"F1\", -- kMenuF1Glyph, 0x6F, F1 key\n * \"F2\", -- kMenuF2Glyph, 0x70, F2 key\n * \"F3\", -- kMenuF3Glyph, 0x71, F3 key\n * \"F4\", -- kMenuF4Glyph, 0x72, F4 key\n * \"F5\", -- kMenuF5Glyph, 0x73, F5 key\n * \"F6\", -- kMenuF6Glyph, 0x74, F6 key\n * \"F7\", -- kMenuF7Glyph, 0x75, F7 key\n * \"F8\", -- kMenuF8Glyph, 0x76, F8 key\n * \"F9\", -- kMenuF9Glyph, 0x77, F9 key\n * \"F10\", -- kMenuF10Glyph, 0x78, F10 key\n * \"F11\", -- kMenuF11Glyph, 0x79, F11 key\n * \"F12\", -- kMenuF12Glyph, 0x7A, F12 key\n * \"F13\", -- kMenuF13Glyph, 0x87, F13 key\n * \"F14\", -- kMenuF14Glyph, 0x88, F14 key\n * \"F15\", -- kMenuF15Glyph, 0x89, F15 key\n * \"⎈\", -- kMenuControlISOGlyph, 0x8A, Control key (ISO standard)\n * \"⏏\", -- kMenuEjectGlyph, 0x8C, Eject key (available on Mac OS X 10.2 and later)\n * \"英数\", -- kMenuEisuGlyph, 0x8D, Japanese eisu key (available in Mac OS X 10.4 and later)\n * \"かな\", -- kMenuKanaGlyph, 0x8E, Japanese kana key (available in Mac OS X 10.4 and later)\n * \"F16\", -- kMenuF16Glyph, 0x8F, F16 key (available in SnowLeopard and later)\n * \"F17\", -- kMenuF16Glyph, 0x90, F17 key (available in SnowLeopard and later)\n * \"F18\", -- kMenuF16Glyph, 0x91, F18 key (available in SnowLeopard and later)\n * \"F19\", -- kMenuF16Glyph, 0x92, F19 key (available in SnowLeopard and later)\n\nNotes:\n * a `__tostring` metamethod is provided for this table so you can view its current contents by typing `hs.application.menuGlyphs` into the Hammerspoon console.\n * This table is provided as a variable so that you can change any representation if you feel you know of a better or more appropriate one for you usage at runtime.\n\n * The glyphs provided are defined in the Carbon framework headers in the Menus.h file, located (as of 10.11) at /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Menus.h.\n * The following constants are defined in Menus.h, but do not seem to correspond to a visible UTF8 character or well defined representation that I could discover. If you believe that you know of a (preferably sanctioned by Apple) proper visual representation, please submit an issue detailing it at the Hammerspoon repository on Github.\n * kMenuNullGlyph, 0x00, Null (always glyph 1)\n * kMenuNonmarkingReturnGlyph, 0x0D, Nonmarking return key\n * kMenuParagraphKoreanGlyph, 0x15, Unassigned (paragraph in Korean)\n * kMenuTrademarkJapaneseGlyph, 0x1F, Unassigned (trademark in Japanese)\n * kMenuAppleLogoOutlineGlyph, 0x6C, Apple logo key (outline)",
"file": "extensions/application/application.lua",
"lineno": "237",
"name": "menuGlyphs",
"notes": [
" * a `__tostring` metamethod is provided for this table so you can view its current contents by typing `hs.application.menuGlyphs` into the Hammerspoon console.",
" * This table is provided as a variable so that you can change any representation if you feel you know of a better or more appropriate one for you usage at runtime.",
"",
" * The glyphs provided are defined in the Carbon framework headers in the Menus.h file, located (as of 10.11) at /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Menus.h.",
" * The following constants are defined in Menus.h, but do not seem to correspond to a visible UTF8 character or well defined representation that I could discover. If you believe that you know of a (preferably sanctioned by Apple) proper visual representation, please submit an issue detailing it at the Hammerspoon repository on Github.",
" * kMenuNullGlyph, 0x00, Null (always glyph 1)",
" * kMenuNonmarkingReturnGlyph, 0x0D, Nonmarking return key",
" * kMenuParagraphKoreanGlyph, 0x15, Unassigned (paragraph in Korean)",
" * kMenuTrademarkJapaneseGlyph, 0x1F, Unassigned (trademark in Japanese)",
" * kMenuAppleLogoOutlineGlyph, 0x6C, Apple logo key (outline)"
],
"signature": "hs.application.menuGlyphs",
"stripped_doc": "These glyphs are indexed numerically where the numeric index matches a possible value for the AXMenuItemCmdGlyph key of an entry returned by `hs.application.getMenus`. If the AXMenuItemCmdGlyph field is non-numeric, then no glyph is used in the presentation of the keyboard shortcut for a menu item.\nThe following glyphs are defined:\n * \"⇥\", -- kMenuTabRightGlyph, 0x02, Tab to the right key (for left-to-right script systems)\n * \"⇤\", -- kMenuTabLeftGlyph, 0x03, Tab to the left key (for right-to-left script systems)\n * \"⌤\", -- kMenuEnterGlyph, 0x04, Enter key\n * \"⇧\", -- kMenuShiftGlyph, 0x05, Shift key\n * \"⌃\", -- kMenuControlGlyph, 0x06, Control key\n * \"⌥\", -- kMenuOptionGlyph, 0x07, Option key\n * \"␣\", -- kMenuSpaceGlyph, 0x09, Space (always glyph 3) key\n * \"⌦\", -- kMenuDeleteRightGlyph, 0x0A, Delete to the right key (for right-to-left script systems)\n * \"↩\", -- kMenuReturnGlyph, 0x0B, Return key (for left-to-right script systems)\n * \"↪\", -- kMenuReturnR2LGlyph, 0x0C, Return key (for right-to-left script systems)\n * \"\", -- kMenuPencilGlyph, 0x0F, Pencil key\n * \"↓\", -- kMenuDownwardArrowDashedGlyph, 0x10, Downward dashed arrow key\n * \"⌘\", -- kMenuCommandGlyph, 0x11, Command key\n * \"✓\", -- kMenuCheckmarkGlyph, 0x12, Checkmark key\n * \"⃟\", -- kMenuDiamondGlyph, 0x13, Diamond key\n * \"\", -- kMenuAppleLogoFilledGlyph, 0x14, Apple logo key (filled)\n * \"⌫\", -- kMenuDeleteLeftGlyph, 0x17, Delete to the left key (for left-to-right script systems)\n * \"←\", -- kMenuLeftArrowDashedGlyph, 0x18, Leftward dashed arrow key\n * \"↑\", -- kMenuUpArrowDashedGlyph, 0x19, Upward dashed arrow key\n * \"→\", -- kMenuRightArrowDashedGlyph, 0x1A, Rightward dashed arrow key\n * \"⎋\", -- kMenuEscapeGlyph, 0x1B, Escape key\n * \"⌧\", -- kMenuClearGlyph, 0x1C, Clear key\n * \"『\", -- kMenuLeftDoubleQuotesJapaneseGlyph, 0x1D, Unassigned (left double quotes in Japanese)\n * \"』\", -- kMenuRightDoubleQuotesJapaneseGlyph, 0x1E, Unassigned (right double quotes in Japanese)\n * \"␢\", -- kMenuBlankGlyph, 0x61, Blank key\n * \"⇞\", -- kMenuPageUpGlyph, 0x62, Page up key\n * \"⇪\", -- kMenuCapsLockGlyph, 0x63, Caps lock key\n * \"←\", -- kMenuLeftArrowGlyph, 0x64, Left arrow key\n * \"→\", -- kMenuRightArrowGlyph, 0x65, Right arrow key\n * \"↖\", -- kMenuNorthwestArrowGlyph, 0x66, Northwest arrow key\n * \"﹖\", -- kMenuHelpGlyph, 0x67, Help key\n * \"↑\", -- kMenuUpArrowGlyph, 0x68, Up arrow key\n * \"↘\", -- kMenuSoutheastArrowGlyph, 0x69, Southeast arrow key\n * \"↓\", -- kMenuDownArrowGlyph, 0x6A, Down arrow key\n * \"⇟\", -- kMenuPageDownGlyph, 0x6B, Page down key\n * \"\", -- kMenuContextualMenuGlyph, 0x6D, Contextual menu key\n * \"⌽\", -- kMenuPowerGlyph, 0x6E, Power key\n * \"F1\", -- kMenuF1Glyph, 0x6F, F1 key\n * \"F2\", -- kMenuF2Glyph, 0x70, F2 key\n * \"F3\", -- kMenuF3Glyph, 0x71, F3 key\n * \"F4\", -- kMenuF4Glyph, 0x72, F4 key\n * \"F5\", -- kMenuF5Glyph, 0x73, F5 key\n * \"F6\", -- kMenuF6Glyph, 0x74, F6 key\n * \"F7\", -- kMenuF7Glyph, 0x75, F7 key\n * \"F8\", -- kMenuF8Glyph, 0x76, F8 key\n * \"F9\", -- kMenuF9Glyph, 0x77, F9 key\n * \"F10\", -- kMenuF10Glyph, 0x78, F10 key\n * \"F11\", -- kMenuF11Glyph, 0x79, F11 key\n * \"F12\", -- kMenuF12Glyph, 0x7A, F12 key\n * \"F13\", -- kMenuF13Glyph, 0x87, F13 key\n * \"F14\", -- kMenuF14Glyph, 0x88, F14 key\n * \"F15\", -- kMenuF15Glyph, 0x89, F15 key\n * \"⎈\", -- kMenuControlISOGlyph, 0x8A, Control key (ISO standard)\n * \"⏏\", -- kMenuEjectGlyph, 0x8C, Eject key (available on Mac OS X 10.2 and later)\n * \"英数\", -- kMenuEisuGlyph, 0x8D, Japanese eisu key (available in Mac OS X 10.4 and later)\n * \"かな\", -- kMenuKanaGlyph, 0x8E, Japanese kana key (available in Mac OS X 10.4 and later)\n * \"F16\", -- kMenuF16Glyph, 0x8F, F16 key (available in SnowLeopard and later)\n * \"F17\", -- kMenuF16Glyph, 0x90, F17 key (available in SnowLeopard and later)\n * \"F18\", -- kMenuF16Glyph, 0x91, F18 key (available in SnowLeopard and later)\n * \"F19\", -- kMenuF16Glyph, 0x92, F19 key (available in SnowLeopard and later)\n * The glyphs provided are defined in the Carbon framework headers in the Menus.h file, located (as of 10.11) at /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Menus.h.\n * The following constants are defined in Menus.h, but do not seem to correspond to a visible UTF8 character or well defined representation that I could discover. If you believe that you know of a (preferably sanctioned by Apple) proper visual representation, please submit an issue detailing it at the Hammerspoon repository on Github.\n * kMenuNullGlyph, 0x00, Null (always glyph 1)\n * kMenuNonmarkingReturnGlyph, 0x0D, Nonmarking return key\n * kMenuParagraphKoreanGlyph, 0x15, Unassigned (paragraph in Korean)\n * kMenuTrademarkJapaneseGlyph, 0x1F, Unassigned (trademark in Japanese)\n * kMenuAppleLogoOutlineGlyph, 0x6C, Apple logo key (outline)",
"type": "Variable"
}
],
"desc": "Manipulate running applications",
"doc": "Manipulate running applications",
"items": [
{
"def": "hs.application:activate([allWindows]) -> bool",
"desc": "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.",
"doc": "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.\n\nParameters:\n * allWindows - If true, all windows of the application will be brought to the front. Otherwise, only the application's key window will. Defaults to false.\n\nReturns:\n * A boolean value indicating whether or not the application could be activated",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "62",
"name": "activate",
"notes": [],
"parameters": [
" * allWindows - If true, all windows of the application will be brought to the front. Otherwise, only the application's key window will. Defaults to false."
],
"returns": [
" * A boolean value indicating whether or not the application could be activated"
],
"signature": "hs.application:activate([allWindows]) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:allWindows() -> list of hs.window objects",
"desc": "Returns all open windows owned by the given app.",
"doc": "Returns all open windows owned by the given app.\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more hs.window objects owned by the application\n\nNotes:\n * This function can only return windows in the current Mission Control Space; if you need to address windows across\n different Spaces you can use the `hs.window.filter` module\n - if `Displays have separate Spaces` is *on* (in System Preferences>Mission Control) the current Space is defined\n as the union of all currently visible Spaces\n - minimized windows and hidden windows (i.e. belonging to hidden apps, e.g. via cmd-h) are always considered\n to be in the current Space",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "182",
"name": "allWindows",
"notes": [
" * This function can only return windows in the current Mission Control Space; if you need to address windows across",
" different Spaces you can use the `hs.window.filter` module",
" - if `Displays have separate Spaces` is *on* (in System Preferences>Mission Control) the current Space is defined",
" as the union of all currently visible Spaces",
" - minimized windows and hidden windows (i.e. belonging to hidden apps, e.g. via cmd-h) are always considered",
" to be in the current Space"
],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more hs.window objects owned by the application"
],
"signature": "hs.application:allWindows() -> list of hs.window objects",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.applicationForPID(pid) -> hs.application object or nil",
"desc": "Returns the running app for the given pid, if it exists.",
"doc": "Returns the running app for the given pid, if it exists.\n\nParameters:\n * pid - a UNIX process id (i.e. a number)\n\nReturns:\n * An hs.application object if one can be found, otherwise nil",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "54",
"name": "applicationForPID",
"notes": [],
"parameters": [
" * pid - a UNIX process id (i.e. a number)"
],
"returns": [
" * An hs.application object if one can be found, otherwise nil"
],
"signature": "hs.application.applicationForPID(pid) -> hs.application object or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.applicationsForBundleID(bundleID) -> list of hs.application objects",
"desc": "Returns any running apps that have the given bundleID.",
"doc": "Returns any running apps that have the given bundleID.\n\nParameters:\n * bundleID - An OSX application bundle indentifier\n\nReturns:\n * A table of zero or more hs.application objects that match the given identifier",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "71",
"name": "applicationsForBundleID",
"notes": [],
"parameters": [
" * bundleID - An OSX application bundle indentifier"
],
"returns": [
" * A table of zero or more hs.application objects that match the given identifier"
],
"signature": "hs.application.applicationsForBundleID(bundleID) -> list of hs.application objects",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application:bundleID() -> string",
"desc": "Returns the bundle identifier of the app.",
"doc": "Returns the bundle identifier of the app.\n\nParameters:\n * None\n\nReturns:\n * A string containing the bundle identifier of the application",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "285",
"name": "bundleID",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the bundle identifier of the application"
],
"signature": "hs.application:bundleID() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.defaultAppForUTI(uti) -> string or nil",
"desc": "Returns the bundle ID of the default application for a given UTI",
"doc": "Returns the bundle ID of the default application for a given UTI\n\nParameters:\n * uti - A string containing a UTI\n\nReturns:\n * A string containing a bundle ID, or nil if none could be found",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "151",
"name": "defaultAppForUTI",
"notes": [],
"parameters": [
" * uti - A string containing a UTI"
],
"returns": [
" * A string containing a bundle ID, or nil if none could be found"
],
"signature": "hs.application.defaultAppForUTI(uti) -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.enableSpotlightForNameSearches([state]) -> boolean",
"desc": "Get or set whether Spotlight should be used to find alternate names for applications.",
"doc": "Get or set whether Spotlight should be used to find alternate names for applications.\n\nParameters:\n * `state` - an optional boolean specifying whether or not Spotlight should be used to try and determine alternate application names for `hs.application.find` and similar functions.\n\nReturns:\n * the current, possibly changed, state\n\nNotes:\n * This setting is persistent across reloading and restarting Hammerspoon.\n * If this was set to true and you set it to true again, it will purge the alternate name map and rebuild it from scratch.\n * You can disable Spotlight alternate name mapping by setting this value to false or nil. If you set this to false, then the notifications indicating that more results might be possible if Spotlight is enabled will be suppressed.",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "427",
"name": "enableSpotlightForNameSearches",
"notes": [
" * This setting is persistent across reloading and restarting Hammerspoon.",
" * If this was set to true and you set it to true again, it will purge the alternate name map and rebuild it from scratch.",
" * You can disable Spotlight alternate name mapping by setting this value to false or nil. If you set this to false, then the notifications indicating that more results might be possible if Spotlight is enabled will be suppressed."
],
"parameters": [
" * `state` - an optional boolean specifying whether or not Spotlight should be used to try and determine alternate application names for `hs.application.find` and similar functions."
],
"returns": [
" * the current, possibly changed, state"
],
"signature": "hs.application.enableSpotlightForNameSearches([state]) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.find(hint) -> hs.application object(s)",
"desc": "Finds running applications",
"doc": "Finds running applications\n\nParameters:\n * hint - search criterion for the desired application(s); it can be:\n - a pid number as per `hs.application:pid()`\n - a bundle ID string as per `hs.application:bundleID()`\n - a string pattern that matches (via `string.find`) the application name as per `hs.application:name()` (for convenience, the matching will be done on lowercased strings)\n - a string pattern that matches (via `string.find`) the application's window title per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)\n\nReturns:\n * one or more hs.application objects for running applications that match the supplied search criterion, or `nil` if none found\n\nNotes:\n * If multiple results are found, this function will return multiple values. See [https://www.lua.org/pil/5.1.html](https://www.lua.org/pil/5.1.html) for more information on how to work with this\n * for convenience you can call this as `hs.application(hint)`\n * use this function when you don't know the exact name of an application you're interested in, i.e.\n from the console: `hs.application'term' --> hs.application: iTerm2 (0x61000025fb88) hs.application: Terminal (0x618000447588)`.\n But be careful when using it in your `init.lua`: `terminal=hs.application'term'` will assign either \"Terminal\" or \"iTerm2\" arbitrarily (or even,\n if neither are running, any other app with a window that happens to have \"term\" in its title); to make sure you get the right app in your scripts,\n use `hs.application.get` with the exact name: `terminal=hs.application.get'Terminal' --> \"Terminal\" app, or nil if it's not running`\n\nUsage:\n-- by pid\nhs.application(42):name() --> Finder\n-- by bundle id\nhs.application'com.apple.Safari':name() --> Safari\n-- by name\nhs.application'chrome':name() --> Google Chrome\n-- by window title\nhs.application'bash':name() --> Terminal",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "106",
"name": "find",
"notes": [
" * If multiple results are found, this function will return multiple values. See [https://www.lua.org/pil/5.1.html](https://www.lua.org/pil/5.1.html) for more information on how to work with this",
" * for convenience you can call this as `hs.application(hint)`",
" * use this function when you don't know the exact name of an application you're interested in, i.e.",
" from the console: `hs.application'term' --> hs.application: iTerm2 (0x61000025fb88) hs.application: Terminal (0x618000447588)`.",
" But be careful when using it in your `init.lua`: `terminal=hs.application'term'` will assign either \"Terminal\" or \"iTerm2\" arbitrarily (or even,",
" if neither are running, any other app with a window that happens to have \"term\" in its title); to make sure you get the right app in your scripts,",
" use `hs.application.get` with the exact name: `terminal=hs.application.get'Terminal' --> \"Terminal\" app, or nil if it's not running`",
"",
"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"
],
"parameters": [
" * hint - search criterion for the desired application(s); it can be: - a pid number as per `hs.application:pid()` - a bundle ID string as per `hs.application:bundleID()` - a string pattern that matches (via `string.find`) the application name as per `hs.application:name()` (for convenience, the matching will be done on lowercased strings) - a string pattern that matches (via `string.find`) the application's window title per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)"
],
"returns": [
" * one or more hs.application objects for running applications that match the supplied search criterion, or `nil` if none found"
],
"signature": "hs.application.find(hint) -> hs.application object(s)",
"stripped_doc": "Usage:\n-- by pid\nhs.application(42):name() --> Finder\n-- by bundle id\nhs.application'com.apple.Safari':name() --> Safari\n-- by name\nhs.application'chrome':name() --> Google Chrome\n-- by window title\nhs.application'bash':name() --> Terminal",
"type": "Constructor"
},
{
"def": "hs.application:findMenuItem(menuItem[, isRegex]) -> table or nil",
"desc": "Searches the application for a menu item",
"doc": "Searches the application for a menu item\n\nParameters:\n * menuItem - This can either be a string containing the text of a menu item (e.g. `\"Messages\"`) or a table representing the hierarchical path of a menu item (e.g. `{\"File\", \"Share\", \"Messages\"}`). In the string case, all of the application's menus will be searched until a match is found (with no specified behaviour if multiple menu items exist with the same name). In the table case, the whole menu structure will not be searched, because a precise path has been specified.\n * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against\n\nReturns:\n * Returns nil if the menu item cannot be found. If it does exist, returns a table with two keys:\n * enabled - whether the menu item can be selected/ticked. This will always be false if the application is not currently focussed\n * ticked - whether the menu item is ticked or not (obviously this value is meaningless for menu items that can't be ticked)\n\nNotes:\n * This can only search for menu items that don't have children - i.e. you can't search for the name of a submenu",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "700",
"name": "findMenuItem",
"notes": [
" * This can only search for menu items that don't have children - i.e. you can't search for the name of a submenu"
],
"parameters": [
" * menuItem - This can either be a string containing the text of a menu item (e.g. `\"Messages\"`) or a table representing the hierarchical path of a menu item (e.g. `{\"File\", \"Share\", \"Messages\"}`). In the string case, all of the application's menus will be searched until a match is found (with no specified behaviour if multiple menu items exist with the same name). In the table case, the whole menu structure will not be searched, because a precise path has been specified.",
" * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against"
],
"returns": [
" * Returns nil if the menu item cannot be found. If it does exist, returns a table with two keys:",
" * enabled - whether the menu item can be selected/ticked. This will always be false if the application is not currently focussed",
" * ticked - whether the menu item is ticked or not (obviously this value is meaningless for menu items that can't be ticked)"
],
"signature": "hs.application:findMenuItem(menuItem[, isRegex]) -> table or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:findWindow(titlePattern) -> hs.window object(s)",
"desc": "Finds windows from this application",
"doc": "Finds windows from this application\n\nParameters:\n * titlePattern - a string pattern that matches (via `string.find`) the window title(s) as per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)\n\nReturns:\n * one or more hs.window objects belonging to this application that match the supplied search criterion, or `nil` if none found",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "173",
"name": "findWindow",
"notes": [],
"parameters": [
" * titlePattern - a string pattern that matches (via `string.find`) the window title(s) as per `hs.window:title()` (for convenience, the matching will be done on lowercased strings)"
],
"returns": [
" * one or more hs.window objects belonging to this application that match the supplied search criterion, or `nil` if none found"
],
"signature": "hs.application:findWindow(titlePattern) -> hs.window object(s)",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:focusedWindow() -> hs.window object or nil",
"desc": "Returns the currently focused window of the application, or nil",
"doc": "Returns the currently focused window of the application, or nil\n\nParameters:\n * None\n\nReturns:\n * An hs.window object representing the window of the application that currently has focus, or nil if there are none",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "225",
"name": "focusedWindow",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.window object representing the window of the application that currently has focus, or nil if there are none"
],
"signature": "hs.application:focusedWindow() -> hs.window object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.frontmostApplication() -> hs.application object",
"desc": "Returns the application object for the frontmost (active) application. This is the application which currently receives input events.",
"doc": "Returns the application object for the frontmost (active) application. This is the application which currently receives input events.\n\nParameters:\n * None\n\nReturns:\n * An hs.application object",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "21",
"name": "frontmostApplication",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.application object"
],
"signature": "hs.application.frontmostApplication() -> hs.application object",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.get(hint) -> hs.application object",
"desc": "Gets a running application",
"doc": "Gets a running application\n\nParameters:\n * hint - search criterion for the desired application; it can be:\n - a pid number as per `hs.application:pid()`\n - a bundle ID string as per `hs.application:bundleID()`\n - an application name string as per `hs.application:name()`\n\nReturns:\n * an hs.application object for a running application that matches the supplied search criterion, or `nil` if not found\n\nNotes:\n * see also `hs.application.find`",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "87",
"name": "get",
"notes": [
" * see also `hs.application.find`"
],
"parameters": [
" * hint - search criterion for the desired application; it can be: - a pid number as per `hs.application:pid()` - a bundle ID string as per `hs.application:bundleID()` - an application name string as per `hs.application:name()`"
],
"returns": [
" * an hs.application object for a running application that matches the supplied search criterion, or `nil` if not found"
],
"signature": "hs.application.get(hint) -> hs.application object",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.application:getMenuItems([fn]) -> table or nil | hs.application object",
"desc": "Gets the menu structure of the application",
"doc": "Gets the menu structure of the application\n\nParameters:\n * fn - an optional callback function. If provided, the function will receive a single argument and return none.\n\nReturns:\n * If no argument is provided, returns a table containing the menu structure of the application, or nil if an error occurred. If a callback function is provided, the callback function will receive this table (or nil) and this method will return the application object this method was invoked on.\n\nNotes:\n * In some applications, this can take a little while to complete, because quite a large number of round trips are required to the source application, to get the information. When this method is invoked without a callback function, Hammerspoon will block while creating the menu structure table. When invoked with a callback function, the menu structure is built in a background thread.\n\n * The table is nested with the same structure as the menus of the application. Each item has several keys containing information about the menu item. Not all keys will appear for all items. The possible keys are:\n * AXTitle - A string containing the text of the menu item (entries which have no title are menu separators)\n * AXEnabled - A boolean, 1 if the menu item is clickable, 0 if not\n * AXRole - A string containing the role of the menu item - this will be either AXMenuBarItem for a top level menu, or AXMenuItem for an item in a menu\n * AXMenuItemMarkChar - A string containing the \"mark\" character for a menu item. This is for toggleable menu items and will usually be an empty string or a Unicode tick character (✓)\n * AXMenuItemCmdModifiers - A table containing string representations of the keyboard modifiers for the menu item's keyboard shortcut, or nil if no modifiers are present\n * AXMenuItemCmdChar - A string containing the key for the menu item's keyboard shortcut, or an empty string if no shortcut is present\n * AXMenuItemCmdGlyph - An integer, corresponding to one of the defined glyphs in `hs.application.menuGlyphs` if the keyboard shortcut is a special character usually represented by a pictorial representation (think arrow keys, return, etc), or an empty string if no glyph is used in presenting the keyboard shortcut.\n * Using `hs.inspect()` on these tables, while useful for exploration, can be extremely slow, taking several minutes to correctly render very complex menus",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "961",
"name": "getMenuItems",
"notes": [
" * In some applications, this can take a little while to complete, because quite a large number of round trips are required to the source application, to get the information. When this method is invoked without a callback function, Hammerspoon will block while creating the menu structure table. When invoked with a callback function, the menu structure is built in a background thread.",
"",
" * The table is nested with the same structure as the menus of the application. Each item has several keys containing information about the menu item. Not all keys will appear for all items. The possible keys are:",
" * AXTitle - A string containing the text of the menu item (entries which have no title are menu separators)",
" * AXEnabled - A boolean, 1 if the menu item is clickable, 0 if not",
" * AXRole - A string containing the role of the menu item - this will be either AXMenuBarItem for a top level menu, or AXMenuItem for an item in a menu",
" * AXMenuItemMarkChar - A string containing the \"mark\" character for a menu item. This is for toggleable menu items and will usually be an empty string or a Unicode tick character (✓)",
" * AXMenuItemCmdModifiers - A table containing string representations of the keyboard modifiers for the menu item's keyboard shortcut, or nil if no modifiers are present",
" * AXMenuItemCmdChar - A string containing the key for the menu item's keyboard shortcut, or an empty string if no shortcut is present",
" * AXMenuItemCmdGlyph - An integer, corresponding to one of the defined glyphs in `hs.application.menuGlyphs` if the keyboard shortcut is a special character usually represented by a pictorial representation (think arrow keys, return, etc), or an empty string if no glyph is used in presenting the keyboard shortcut.",
" * Using `hs.inspect()` on these tables, while useful for exploration, can be extremely slow, taking several minutes to correctly render very complex menus"
],
"parameters": [
" * fn - an optional callback function. If provided, the function will receive a single argument and return none."
],
"returns": [
" * If no argument is provided, returns a table containing the menu structure of the application, or nil if an error occurred. If a callback function is provided, the callback function will receive this table (or nil) and this method will return the application object this method was invoked on."
],
"signature": "hs.application:getMenuItems([fn]) -> table or nil | hs.application object",
"stripped_doc": " * The table is nested with the same structure as the menus of the application. Each item has several keys containing information about the menu item. Not all keys will appear for all items. The possible keys are:\n * AXTitle - A string containing the text of the menu item (entries which have no title are menu separators)\n * AXEnabled - A boolean, 1 if the menu item is clickable, 0 if not\n * AXRole - A string containing the role of the menu item - this will be either AXMenuBarItem for a top level menu, or AXMenuItem for an item in a menu\n * AXMenuItemMarkChar - A string containing the \"mark\" character for a menu item. This is for toggleable menu items and will usually be an empty string or a Unicode tick character (✓)\n * AXMenuItemCmdModifiers - A table containing string representations of the keyboard modifiers for the menu item's keyboard shortcut, or nil if no modifiers are present\n * AXMenuItemCmdChar - A string containing the key for the menu item's keyboard shortcut, or an empty string if no shortcut is present\n * AXMenuItemCmdGlyph - An integer, corresponding to one of the defined glyphs in `hs.application.menuGlyphs` if the keyboard shortcut is a special character usually represented by a pictorial representation (think arrow keys, return, etc), or an empty string if no glyph is used in presenting the keyboard shortcut.\n * Using `hs.inspect()` on these tables, while useful for exploration, can be extremely slow, taking several minutes to correctly render very complex menus",
"type": "Method"
},
{
"def": "hs.application:getWindow(title) -> hs.window object",
"desc": "Gets a specific window from this application",
"doc": "Gets a specific window from this application\n\nParameters:\n * title - the desired window's title string as per `hs.window:title()`\n\nReturns:\n * the desired hs.window object belonging to this application, or `nil` if not found",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "187",
"name": "getWindow",
"notes": [],
"parameters": [
" * title - the desired window's title string as per `hs.window:title()`"
],
"returns": [
" * the desired hs.window object belonging to this application, or `nil` if not found"
],
"signature": "hs.application:getWindow(title) -> hs.window object",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:hide() -> boolean",
"desc": "Hides the app (and all its windows).",
"doc": "Hides the app (and all its windows).\n\nParameters:\n * None\n\nReturns:\n * A boolean indicating whether the application was successfully hidden",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "357",
"name": "hide",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean indicating whether the application was successfully hidden"
],
"signature": "hs.application:hide() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.infoForBundleID(bundleID) -> table or nil",
"desc": "Gets the metadata of an application from its bundle identifier",
"doc": "Gets the metadata of an application from its bundle identifier\n\nParameters:\n * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")\n\nReturns:\n * A table containing information about the application, or nil if the bundle identifier could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "119",
"name": "infoForBundleID",
"notes": [],
"parameters": [
" * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")"
],
"returns": [
" * A table containing information about the application, or nil if the bundle identifier could not be located"
],
"signature": "hs.application.infoForBundleID(bundleID) -> table or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.infoForBundlePath(bundlePath) -> table or nil",
"desc": "Gets the metadata of an application from its path on disk",
"doc": "Gets the metadata of an application from its path on disk\n\nParameters:\n * bundlePath - A string containing the path to an application bundle (e.g. \"/Applications/Safari.app\")\n\nReturns:\n * A table containing information about the application, or nil if the bundle could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "135",
"name": "infoForBundlePath",
"notes": [],
"parameters": [
" * bundlePath - A string containing the path to an application bundle (e.g. \"/Applications/Safari.app\")"
],
"returns": [
" * A table containing information about the application, or nil if the bundle could not be located"
],
"signature": "hs.application.infoForBundlePath(bundlePath) -> table or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application:isFrontmost() -> boolean",
"desc": "Returns whether the app is the frontmost (i.e. is the currently active application)",
"doc": "Returns whether the app is the frontmost (i.e. is the currently active application)\n\nParameters:\n * None\n\nReturns:\n * True if the application is the frontmost application, otherwise false",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "426",
"name": "isFrontmost",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the application is the frontmost application, otherwise false"
],
"signature": "hs.application:isFrontmost() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:isHidden() -> boolean",
"desc": "Returns whether the app is currently hidden.",
"doc": "Returns whether the app is currently hidden.\n\nParameters:\n * None\n\nReturns:\n * A boolean indicating whether the application is hidden or not",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "409",
"name": "isHidden",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean indicating whether the application is hidden or not"
],
"signature": "hs.application:isHidden() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:isRunning() -> boolean",
"desc": "Checks if the application is still running",
"doc": "Checks if the application is still running\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the application is running, false if not\n\nNotes:\n * If an application is terminated and re-launched, this method will still return false, as `hs.application` objects are tied to a specific instance of an application (i.e. its PID)",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "319",
"name": "isRunning",
"notes": [
" * If an application is terminated and re-launched, this method will still return false, as `hs.application` objects are tied to a specific instance of an application (i.e. its PID)"
],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the application is running, false if not"
],
"signature": "hs.application:isRunning() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:kill()",
"desc": "Tries to terminate the app gracefully.",
"doc": "Tries to terminate the app gracefully.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "375",
"name": "kill",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.application:kill()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:kill9()",
"desc": "Tries to terminate the app forcefully.",
"doc": "Tries to terminate the app forcefully.\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "392",
"name": "kill9",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.application:kill9()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:kind() -> number",
"desc": "Identify the application's GUI state",
"doc": "Identify the application's GUI state\n\nParameters:\n * None\n\nReturns:\n * A number that is either 1 if the app is in the dock, 0 if it is not, or -1 if the application is prohibited from having GUI elements",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "483",
"name": "kind",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number that is either 1 if the app is in the dock, 0 if it is not, or -1 if the application is prohibited from having GUI elements"
],
"signature": "hs.application:kind() -> number",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.launchOrFocus(name) -> boolean",
"desc": "Launches the app with the given name, or activates it if it's already running",
"doc": "Launches the app with the given name, or activates it if it's already running\n\nParameters:\n * name - A string containing the name of the application to either launch or focus. This can also be the full path to an application (including the `.app` suffix) if you need to uniquely distinguish between applications in different locations that share the same name\n\nReturns:\n * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)\n\nNotes:\n * The name parameter should match the name of the application on disk, e.g. \"IntelliJ IDEA\", rather than \"IntelliJ\"",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "1028",
"name": "launchOrFocus",
"notes": [
" * The name parameter should match the name of the application on disk, e.g. \"IntelliJ IDEA\", rather than \"IntelliJ\""
],
"parameters": [
" * name - A string containing the name of the application to either launch or focus. This can also be the full path to an application (including the `.app` suffix) if you need to uniquely distinguish between applications in different locations that share the same name"
],
"returns": [
" * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)"
],
"signature": "hs.application.launchOrFocus(name) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.launchOrFocusByBundleID(bundleID) -> boolean",
"desc": "Launches the app with the given bundle ID, or activates it if it's already running",
"doc": "Launches the app with the given bundle ID, or activates it if it's already running\n\nParameters:\n * bundleID - A string containing the bundle ID of the application to either launch or focus.\n\nReturns:\n * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)\n\nNotes:\n * Bundle identifiers typically take the form of `com.company.ApplicationName`",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "1047",
"name": "launchOrFocusByBundleID",
"notes": [
" * Bundle identifiers typically take the form of `com.company.ApplicationName`"
],
"parameters": [
" * bundleID - A string containing the bundle ID of the application to either launch or focus."
],
"returns": [
" * True if the application was either launched or focused, otherwise false (e.g. if the application doesn't exist)"
],
"signature": "hs.application.launchOrFocusByBundleID(bundleID) -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application:mainWindow() -> hs.window object or nil",
"desc": "Returns the main window of the given app, or nil.",
"doc": "Returns the main window of the given app, or nil.\n\nParameters:\n * None\n\nReturns:\n * An hs.window object representing the main window of the application, or nil if it has no windows",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "208",
"name": "mainWindow",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.window object representing the main window of the application, or nil if it has no windows"
],
"signature": "hs.application:mainWindow() -> hs.window object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.menuGlyphs",
"desc": "A table containing UTF8 representations of the defined key glyphs used in Menus for keybaord shortcuts which are presented pictorially rather than as text (arrow keys, return key, etc.)",
"doc": "A table containing UTF8 representations of the defined key glyphs used in Menus for keybaord shortcuts which are presented pictorially rather than as text (arrow keys, return key, etc.)\n\nThese glyphs are indexed numerically where the numeric index matches a possible value for the AXMenuItemCmdGlyph key of an entry returned by `hs.application.getMenus`. If the AXMenuItemCmdGlyph field is non-numeric, then no glyph is used in the presentation of the keyboard shortcut for a menu item.\n\nThe following glyphs are defined:\n * \"⇥\", -- kMenuTabRightGlyph, 0x02, Tab to the right key (for left-to-right script systems)\n * \"⇤\", -- kMenuTabLeftGlyph, 0x03, Tab to the left key (for right-to-left script systems)\n * \"⌤\", -- kMenuEnterGlyph, 0x04, Enter key\n * \"⇧\", -- kMenuShiftGlyph, 0x05, Shift key\n * \"⌃\", -- kMenuControlGlyph, 0x06, Control key\n * \"⌥\", -- kMenuOptionGlyph, 0x07, Option key\n * \"␣\", -- kMenuSpaceGlyph, 0x09, Space (always glyph 3) key\n * \"⌦\", -- kMenuDeleteRightGlyph, 0x0A, Delete to the right key (for right-to-left script systems)\n * \"↩\", -- kMenuReturnGlyph, 0x0B, Return key (for left-to-right script systems)\n * \"↪\", -- kMenuReturnR2LGlyph, 0x0C, Return key (for right-to-left script systems)\n * \"\", -- kMenuPencilGlyph, 0x0F, Pencil key\n * \"↓\", -- kMenuDownwardArrowDashedGlyph, 0x10, Downward dashed arrow key\n * \"⌘\", -- kMenuCommandGlyph, 0x11, Command key\n * \"✓\", -- kMenuCheckmarkGlyph, 0x12, Checkmark key\n * \"⃟\", -- kMenuDiamondGlyph, 0x13, Diamond key\n * \"\", -- kMenuAppleLogoFilledGlyph, 0x14, Apple logo key (filled)\n * \"⌫\", -- kMenuDeleteLeftGlyph, 0x17, Delete to the left key (for left-to-right script systems)\n * \"←\", -- kMenuLeftArrowDashedGlyph, 0x18, Leftward dashed arrow key\n * \"↑\", -- kMenuUpArrowDashedGlyph, 0x19, Upward dashed arrow key\n * \"→\", -- kMenuRightArrowDashedGlyph, 0x1A, Rightward dashed arrow key\n * \"⎋\", -- kMenuEscapeGlyph, 0x1B, Escape key\n * \"⌧\", -- kMenuClearGlyph, 0x1C, Clear key\n * \"『\", -- kMenuLeftDoubleQuotesJapaneseGlyph, 0x1D, Unassigned (left double quotes in Japanese)\n * \"』\", -- kMenuRightDoubleQuotesJapaneseGlyph, 0x1E, Unassigned (right double quotes in Japanese)\n * \"␢\", -- kMenuBlankGlyph, 0x61, Blank key\n * \"⇞\", -- kMenuPageUpGlyph, 0x62, Page up key\n * \"⇪\", -- kMenuCapsLockGlyph, 0x63, Caps lock key\n * \"←\", -- kMenuLeftArrowGlyph, 0x64, Left arrow key\n * \"→\", -- kMenuRightArrowGlyph, 0x65, Right arrow key\n * \"↖\", -- kMenuNorthwestArrowGlyph, 0x66, Northwest arrow key\n * \"﹖\", -- kMenuHelpGlyph, 0x67, Help key\n * \"↑\", -- kMenuUpArrowGlyph, 0x68, Up arrow key\n * \"↘\", -- kMenuSoutheastArrowGlyph, 0x69, Southeast arrow key\n * \"↓\", -- kMenuDownArrowGlyph, 0x6A, Down arrow key\n * \"⇟\", -- kMenuPageDownGlyph, 0x6B, Page down key\n * \"\", -- kMenuContextualMenuGlyph, 0x6D, Contextual menu key\n * \"⌽\", -- kMenuPowerGlyph, 0x6E, Power key\n * \"F1\", -- kMenuF1Glyph, 0x6F, F1 key\n * \"F2\", -- kMenuF2Glyph, 0x70, F2 key\n * \"F3\", -- kMenuF3Glyph, 0x71, F3 key\n * \"F4\", -- kMenuF4Glyph, 0x72, F4 key\n * \"F5\", -- kMenuF5Glyph, 0x73, F5 key\n * \"F6\", -- kMenuF6Glyph, 0x74, F6 key\n * \"F7\", -- kMenuF7Glyph, 0x75, F7 key\n * \"F8\", -- kMenuF8Glyph, 0x76, F8 key\n * \"F9\", -- kMenuF9Glyph, 0x77, F9 key\n * \"F10\", -- kMenuF10Glyph, 0x78, F10 key\n * \"F11\", -- kMenuF11Glyph, 0x79, F11 key\n * \"F12\", -- kMenuF12Glyph, 0x7A, F12 key\n * \"F13\", -- kMenuF13Glyph, 0x87, F13 key\n * \"F14\", -- kMenuF14Glyph, 0x88, F14 key\n * \"F15\", -- kMenuF15Glyph, 0x89, F15 key\n * \"⎈\", -- kMenuControlISOGlyph, 0x8A, Control key (ISO standard)\n * \"⏏\", -- kMenuEjectGlyph, 0x8C, Eject key (available on Mac OS X 10.2 and later)\n * \"英数\", -- kMenuEisuGlyph, 0x8D, Japanese eisu key (available in Mac OS X 10.4 and later)\n * \"かな\", -- kMenuKanaGlyph, 0x8E, Japanese kana key (available in Mac OS X 10.4 and later)\n * \"F16\", -- kMenuF16Glyph, 0x8F, F16 key (available in SnowLeopard and later)\n * \"F17\", -- kMenuF16Glyph, 0x90, F17 key (available in SnowLeopard and later)\n * \"F18\", -- kMenuF16Glyph, 0x91, F18 key (available in SnowLeopard and later)\n * \"F19\", -- kMenuF16Glyph, 0x92, F19 key (available in SnowLeopard and later)\n\nNotes:\n * a `__tostring` metamethod is provided for this table so you can view its current contents by typing `hs.application.menuGlyphs` into the Hammerspoon console.\n * This table is provided as a variable so that you can change any representation if you feel you know of a better or more appropriate one for you usage at runtime.\n\n * The glyphs provided are defined in the Carbon framework headers in the Menus.h file, located (as of 10.11) at /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Menus.h.\n * The following constants are defined in Menus.h, but do not seem to correspond to a visible UTF8 character or well defined representation that I could discover. If you believe that you know of a (preferably sanctioned by Apple) proper visual representation, please submit an issue detailing it at the Hammerspoon repository on Github.\n * kMenuNullGlyph, 0x00, Null (always glyph 1)\n * kMenuNonmarkingReturnGlyph, 0x0D, Nonmarking return key\n * kMenuParagraphKoreanGlyph, 0x15, Unassigned (paragraph in Korean)\n * kMenuTrademarkJapaneseGlyph, 0x1F, Unassigned (trademark in Japanese)\n * kMenuAppleLogoOutlineGlyph, 0x6C, Apple logo key (outline)",
"file": "extensions/application/application.lua",
"lineno": "237",
"name": "menuGlyphs",
"notes": [
" * a `__tostring` metamethod is provided for this table so you can view its current contents by typing `hs.application.menuGlyphs` into the Hammerspoon console.",
" * This table is provided as a variable so that you can change any representation if you feel you know of a better or more appropriate one for you usage at runtime.",
"",
" * The glyphs provided are defined in the Carbon framework headers in the Menus.h file, located (as of 10.11) at /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Menus.h.",
" * The following constants are defined in Menus.h, but do not seem to correspond to a visible UTF8 character or well defined representation that I could discover. If you believe that you know of a (preferably sanctioned by Apple) proper visual representation, please submit an issue detailing it at the Hammerspoon repository on Github.",
" * kMenuNullGlyph, 0x00, Null (always glyph 1)",
" * kMenuNonmarkingReturnGlyph, 0x0D, Nonmarking return key",
" * kMenuParagraphKoreanGlyph, 0x15, Unassigned (paragraph in Korean)",
" * kMenuTrademarkJapaneseGlyph, 0x1F, Unassigned (trademark in Japanese)",
" * kMenuAppleLogoOutlineGlyph, 0x6C, Apple logo key (outline)"
],
"signature": "hs.application.menuGlyphs",
"stripped_doc": "These glyphs are indexed numerically where the numeric index matches a possible value for the AXMenuItemCmdGlyph key of an entry returned by `hs.application.getMenus`. If the AXMenuItemCmdGlyph field is non-numeric, then no glyph is used in the presentation of the keyboard shortcut for a menu item.\nThe following glyphs are defined:\n * \"⇥\", -- kMenuTabRightGlyph, 0x02, Tab to the right key (for left-to-right script systems)\n * \"⇤\", -- kMenuTabLeftGlyph, 0x03, Tab to the left key (for right-to-left script systems)\n * \"⌤\", -- kMenuEnterGlyph, 0x04, Enter key\n * \"⇧\", -- kMenuShiftGlyph, 0x05, Shift key\n * \"⌃\", -- kMenuControlGlyph, 0x06, Control key\n * \"⌥\", -- kMenuOptionGlyph, 0x07, Option key\n * \"␣\", -- kMenuSpaceGlyph, 0x09, Space (always glyph 3) key\n * \"⌦\", -- kMenuDeleteRightGlyph, 0x0A, Delete to the right key (for right-to-left script systems)\n * \"↩\", -- kMenuReturnGlyph, 0x0B, Return key (for left-to-right script systems)\n * \"↪\", -- kMenuReturnR2LGlyph, 0x0C, Return key (for right-to-left script systems)\n * \"\", -- kMenuPencilGlyph, 0x0F, Pencil key\n * \"↓\", -- kMenuDownwardArrowDashedGlyph, 0x10, Downward dashed arrow key\n * \"⌘\", -- kMenuCommandGlyph, 0x11, Command key\n * \"✓\", -- kMenuCheckmarkGlyph, 0x12, Checkmark key\n * \"⃟\", -- kMenuDiamondGlyph, 0x13, Diamond key\n * \"\", -- kMenuAppleLogoFilledGlyph, 0x14, Apple logo key (filled)\n * \"⌫\", -- kMenuDeleteLeftGlyph, 0x17, Delete to the left key (for left-to-right script systems)\n * \"←\", -- kMenuLeftArrowDashedGlyph, 0x18, Leftward dashed arrow key\n * \"↑\", -- kMenuUpArrowDashedGlyph, 0x19, Upward dashed arrow key\n * \"→\", -- kMenuRightArrowDashedGlyph, 0x1A, Rightward dashed arrow key\n * \"⎋\", -- kMenuEscapeGlyph, 0x1B, Escape key\n * \"⌧\", -- kMenuClearGlyph, 0x1C, Clear key\n * \"『\", -- kMenuLeftDoubleQuotesJapaneseGlyph, 0x1D, Unassigned (left double quotes in Japanese)\n * \"』\", -- kMenuRightDoubleQuotesJapaneseGlyph, 0x1E, Unassigned (right double quotes in Japanese)\n * \"␢\", -- kMenuBlankGlyph, 0x61, Blank key\n * \"⇞\", -- kMenuPageUpGlyph, 0x62, Page up key\n * \"⇪\", -- kMenuCapsLockGlyph, 0x63, Caps lock key\n * \"←\", -- kMenuLeftArrowGlyph, 0x64, Left arrow key\n * \"→\", -- kMenuRightArrowGlyph, 0x65, Right arrow key\n * \"↖\", -- kMenuNorthwestArrowGlyph, 0x66, Northwest arrow key\n * \"﹖\", -- kMenuHelpGlyph, 0x67, Help key\n * \"↑\", -- kMenuUpArrowGlyph, 0x68, Up arrow key\n * \"↘\", -- kMenuSoutheastArrowGlyph, 0x69, Southeast arrow key\n * \"↓\", -- kMenuDownArrowGlyph, 0x6A, Down arrow key\n * \"⇟\", -- kMenuPageDownGlyph, 0x6B, Page down key\n * \"\", -- kMenuContextualMenuGlyph, 0x6D, Contextual menu key\n * \"⌽\", -- kMenuPowerGlyph, 0x6E, Power key\n * \"F1\", -- kMenuF1Glyph, 0x6F, F1 key\n * \"F2\", -- kMenuF2Glyph, 0x70, F2 key\n * \"F3\", -- kMenuF3Glyph, 0x71, F3 key\n * \"F4\", -- kMenuF4Glyph, 0x72, F4 key\n * \"F5\", -- kMenuF5Glyph, 0x73, F5 key\n * \"F6\", -- kMenuF6Glyph, 0x74, F6 key\n * \"F7\", -- kMenuF7Glyph, 0x75, F7 key\n * \"F8\", -- kMenuF8Glyph, 0x76, F8 key\n * \"F9\", -- kMenuF9Glyph, 0x77, F9 key\n * \"F10\", -- kMenuF10Glyph, 0x78, F10 key\n * \"F11\", -- kMenuF11Glyph, 0x79, F11 key\n * \"F12\", -- kMenuF12Glyph, 0x7A, F12 key\n * \"F13\", -- kMenuF13Glyph, 0x87, F13 key\n * \"F14\", -- kMenuF14Glyph, 0x88, F14 key\n * \"F15\", -- kMenuF15Glyph, 0x89, F15 key\n * \"⎈\", -- kMenuControlISOGlyph, 0x8A, Control key (ISO standard)\n * \"⏏\", -- kMenuEjectGlyph, 0x8C, Eject key (available on Mac OS X 10.2 and later)\n * \"英数\", -- kMenuEisuGlyph, 0x8D, Japanese eisu key (available in Mac OS X 10.4 and later)\n * \"かな\", -- kMenuKanaGlyph, 0x8E, Japanese kana key (available in Mac OS X 10.4 and later)\n * \"F16\", -- kMenuF16Glyph, 0x8F, F16 key (available in SnowLeopard and later)\n * \"F17\", -- kMenuF16Glyph, 0x90, F17 key (available in SnowLeopard and later)\n * \"F18\", -- kMenuF16Glyph, 0x91, F18 key (available in SnowLeopard and later)\n * \"F19\", -- kMenuF16Glyph, 0x92, F19 key (available in SnowLeopard and later)\n * The glyphs provided are defined in the Carbon framework headers in the Menus.h file, located (as of 10.11) at /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/Menus.h.\n * The following constants are defined in Menus.h, but do not seem to correspond to a visible UTF8 character or well defined representation that I could discover. If you believe that you know of a (preferably sanctioned by Apple) proper visual representation, please submit an issue detailing it at the Hammerspoon repository on Github.\n * kMenuNullGlyph, 0x00, Null (always glyph 1)\n * kMenuNonmarkingReturnGlyph, 0x0D, Nonmarking return key\n * kMenuParagraphKoreanGlyph, 0x15, Unassigned (paragraph in Korean)\n * kMenuTrademarkJapaneseGlyph, 0x1F, Unassigned (trademark in Japanese)\n * kMenuAppleLogoOutlineGlyph, 0x6C, Apple logo key (outline)",
"type": "Variable"
},
{
"def": "hs.application:name()",
"desc": "Alias for [`hs.application:title()`](#title)",
"doc": "Alias for [`hs.application:title()`](#title)",
"file": "extensions/application/application.lua",
"lineno": "82",
"name": "name",
"notes": [],
"parameters": [],
"returns": [],
"signature": "hs.application:name()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.nameForBundleID(bundleID) -> string or nil",
"desc": "Gets the name of an application from its bundle identifier",
"doc": "Gets the name of an application from its bundle identifier\n\nParameters:\n * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")\n\nReturns:\n * A string containing the application name, or nil if the bundle identifier could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "87",
"name": "nameForBundleID",
"notes": [],
"parameters": [
" * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")"
],
"returns": [
" * A string containing the application name, or nil if the bundle identifier could not be located"
],
"signature": "hs.application.nameForBundleID(bundleID) -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application.open(app[, wait, [waitForFirstWindow]]) -> hs.application object",
"desc": "Launches an application, or activates it if it's already running",
"doc": "Launches an application, or activates it if it's already running\n\nParameters:\n * app - a string describing the application to open; it can be:\n - the application's name as per `hs.application:name()`\n - the full path to an application on disk (including the `.app` suffix)\n - the application's bundle ID as per `hs.application:bundleID()`\n * wait - (optional) the maximum number of seconds to wait for the app to be launched, if not already running; if omitted, defaults to 0;\n if the app takes longer than this to launch, this function will return `nil`, but the app will still launch\n * waitForFirstWindow - (optional) if `true`, additionally wait until the app has spawned its first window (which usually takes a bit longer)\n\nReturns:\n * the `hs.application` object for the launched or activated application; `nil` if not found\n\nNotes:\n * the `wait` parameter will *block all Hammerspoon activity* in order to return the application object \"synchronously\"; only use it if you\n a) have no time-critical event processing happening elsewhere in your `init.lua` and b) need to act on the application object, or on\n its window(s), right away\n * when launching a \"windowless\" app (background daemon, menulet, etc.) make sure to omit `waitForFirstWindow`",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "200",
"name": "open",
"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`"
],
"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"
],
"signature": "hs.application.open(app[, wait, [waitForFirstWindow]]) -> hs.application object",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.application:path() -> string",
"desc": "Returns the filesystem path of the app.",
"doc": "Returns the filesystem path of the app.\n\nParameters:\n * None\n\nReturns:\n * A string containing the filesystem path of the application or nil if the path could not be determined (e.g. if the application has terminated).",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "302",
"name": "path",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the filesystem path of the application or nil if the path could not be determined (e.g. if the application has terminated)."
],
"signature": "hs.application:path() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.pathForBundleID(bundleID) -> string or nil",
"desc": "Gets the filesystem path of an application from its bundle identifier",
"doc": "Gets the filesystem path of an application from its bundle identifier\n\nParameters:\n * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")\n\nReturns:\n * A string containing the app bundle's filesystem path, or nil if the bundle identifier could not be located",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "103",
"name": "pathForBundleID",
"notes": [],
"parameters": [
" * bundleID - A string containing an application bundle identifier (e.g. \"com.apple.Safari\")"
],
"returns": [
" * A string containing the app bundle's filesystem path, or nil if the bundle identifier could not be located"
],
"signature": "hs.application.pathForBundleID(bundleID) -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application:pid() -> number",
"desc": "Returns the app's process identifier.",
"doc": "Returns the app's process identifier.\n\nParameters:\n * None\n\nReturns:\n * The UNIX process identifier of the application (i.e. a number)",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "466",
"name": "pid",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The UNIX process identifier of the application (i.e. a number)"
],
"signature": "hs.application:pid() -> number",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.runningApplications() -> list of hs.application objects",
"desc": "Returns all running apps.",
"doc": "Returns all running apps.\n\nParameters:\n * None\n\nReturns:\n * A table containing zero or more hs.application objects currently running on the system",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "37",
"name": "runningApplications",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing zero or more hs.application objects currently running on the system"
],
"signature": "hs.application.runningApplications() -> list of hs.application objects",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.application:selectMenuItem(menuitem[, isRegex]) -> true or nil",
"desc": "Selects a menu item (i.e. simulates clicking on the menu item)",
"doc": "Selects a menu item (i.e. simulates clicking on the menu item)\n\nParameters:\n * menuitem - The menu item to select, specified as either a string or a table. See the `menuitem` parameter of `hs.application:findMenuItem()` for more information.\n * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against\n\nReturns:\n * True if the menu item was found and selected, or nil if it wasn't (e.g. because the menu item couldn't be found)\n\nNotes:\n * Depending on the type of menu item involved, this will either activate or tick/untick the menu item",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "791",
"name": "selectMenuItem",
"notes": [
" * Depending on the type of menu item involved, this will either activate or tick/untick the menu item"
],
"parameters": [
" * menuitem - The menu item to select, specified as either a string or a table. See the `menuitem` parameter of `hs.application:findMenuItem()` for more information.",
" * isRegex - An optional boolean, defaulting to false, which is only used if `menuItem` is a string. If set to true, `menuItem` will be treated as a regular expression rather than a strict string to match against"
],
"returns": [
" * True if the menu item was found and selected, or nil if it wasn't (e.g. because the menu item couldn't be found)"
],
"signature": "hs.application:selectMenuItem(menuitem[, isRegex]) -> true or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:setFrontmost([allWindows]) -> boolean",
"desc": "Sets the app to the frontmost (i.e. currently active) application",
"doc": "Sets the app to the frontmost (i.e. currently active) application\n\nParameters:\n * allWindows - An optional boolean, true to bring all windows of the application to the front. Defaults to false\n\nReturns:\n * A boolean, true if the operation was successful, otherwise false",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "443",
"name": "setFrontmost",
"notes": [],
"parameters": [
" * allWindows - An optional boolean, true to bring all windows of the application to the front. Defaults to false"
],
"returns": [
" * A boolean, true if the operation was successful, otherwise false"
],
"signature": "hs.application:setFrontmost([allWindows]) -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:title() -> string",
"desc": "Returns the localized name of the app (in UTF8).",
"doc": "Returns the localized name of the app (in UTF8).\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the application",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "268",
"name": "title",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the application"
],
"signature": "hs.application:title() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:unhide() -> boolean",
"desc": "Unhides the app (and all its windows) if it's hidden.",
"doc": "Unhides the app (and all its windows) if it's hidden.\n\nParameters:\n * None\n\nReturns:\n * A boolean indicating whether the application was successfully unhidden",
"examples": [],
"file": "extensions/application/libapplication.m",
"lineno": "339",
"name": "unhide",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean indicating whether the application was successfully unhidden"
],
"signature": "hs.application:unhide() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application:visibleWindows() -> win[]",
"desc": "Returns only the app's windows that are visible.",
"doc": "Returns only the app's windows that are visible.\n\nParameters:\n * None\n\nReturns:\n * A table containing zero or more hs.window objects",
"examples": [],
"file": "extensions/application/application.lua",
"lineno": "46",
"name": "visibleWindows",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing zero or more hs.window objects"
],
"signature": "hs.application:visibleWindows() -> win[]",
"stripped_doc": "",
"type": "Method"
}
],
"name": "hs.application",
"stripped_doc": "",
"submodules": [
"watcher"
],
"type": "Module"
},
{
"Command": [],
"Constant": [
{
"def": "hs.application.watcher.activated",
"desc": "An application has been activated (i.e. given keyboard/mouse focus)",
"doc": "An application has been activated (i.e. given keyboard/mouse focus)",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "33",
"name": "activated",
"signature": "hs.application.watcher.activated",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.deactivated",
"desc": "An application has been deactivated (i.e. lost keyboard/mouse focus)",
"doc": "An application has been deactivated (i.e. lost keyboard/mouse focus)",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "37",
"name": "deactivated",
"signature": "hs.application.watcher.deactivated",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.hidden",
"desc": "An application has been hidden",
"doc": "An application has been hidden",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "25",
"name": "hidden",
"signature": "hs.application.watcher.hidden",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.launched",
"desc": "An application has been launched",
"doc": "An application has been launched",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "17",
"name": "launched",
"signature": "hs.application.watcher.launched",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.launching",
"desc": "An application is in the process of being launched",
"doc": "An application is in the process of being launched",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "13",
"name": "launching",
"signature": "hs.application.watcher.launching",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.terminated",
"desc": "An application has been terminated",
"doc": "An application has been terminated",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "21",
"name": "terminated",
"signature": "hs.application.watcher.terminated",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.unhidden",
"desc": "An application has been unhidden",
"doc": "An application has been unhidden",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "29",
"name": "unhidden",
"signature": "hs.application.watcher.unhidden",
"stripped_doc": "",
"type": "Constant"
}
],
"Constructor": [
{
"def": "hs.application.watcher.new(fn) -> watcher",
"desc": "Creates an application event watcher",
"doc": "Creates an application event watcher\n\nParameters:\n * fn - A function that will be called when application events happen. It should accept three parameters:\n * A string containing the name of the application\n * An event type (see the constants defined above)\n * An `hs.application` object representing the application, or nil if the application couldn't be found\n\nReturns:\n * An `hs.application.watcher` object\n\nNotes:\n * If the function is called with an event type of `hs.application.watcher.terminated` then the application name parameter will be `nil` and the `hs.application` parameter, will only be useful for getting the UNIX process ID (i.e. the PID) of the application",
"examples": [],
"file": "extensions/application/libapplication_watcher.m",
"lineno": "142",
"name": "new",
"notes": [
" * If the function is called with an event type of `hs.application.watcher.terminated` then the application name parameter will be `nil` and the `hs.application` parameter, will only be useful for getting the UNIX process ID (i.e. the PID) of the application"
],
"parameters": [
" * fn - A function that will be called when application events happen. It should accept three parameters:\n * A string containing the name of the application\n * An event type (see the constants defined above)\n * An `hs.application` object representing the application, or nil if the application couldn't be found"
],
"returns": [
" * An `hs.application.watcher` object"
],
"signature": "hs.application.watcher.new(fn) -> watcher",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "hs.application.watcher:start()",
"desc": "Starts the application watcher",
"doc": "Starts the application watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.application.watcher` object",
"examples": [],
"file": "extensions/application/libapplication_watcher.m",
"lineno": "224",
"name": "start",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.application.watcher` object"
],
"signature": "hs.application.watcher:start()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.watcher:stop()",
"desc": "Stops the application watcher",
"doc": "Stops the application watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.application.watcher` object",
"examples": [],
"file": "extensions/application/libapplication_watcher.m",
"lineno": "247",
"name": "stop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.application.watcher` object"
],
"signature": "hs.application.watcher:stop()",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "Watch for application launch/terminate events",
"doc": "Watch for application launch/terminate events\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Markus Engelbrecht](https://github.com/mgee) and [Steven Degutis](https://github.com/sdegutis/).",
"items": [
{
"def": "hs.application.watcher.activated",
"desc": "An application has been activated (i.e. given keyboard/mouse focus)",
"doc": "An application has been activated (i.e. given keyboard/mouse focus)",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "33",
"name": "activated",
"signature": "hs.application.watcher.activated",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.deactivated",
"desc": "An application has been deactivated (i.e. lost keyboard/mouse focus)",
"doc": "An application has been deactivated (i.e. lost keyboard/mouse focus)",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "37",
"name": "deactivated",
"signature": "hs.application.watcher.deactivated",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.hidden",
"desc": "An application has been hidden",
"doc": "An application has been hidden",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "25",
"name": "hidden",
"signature": "hs.application.watcher.hidden",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.launched",
"desc": "An application has been launched",
"doc": "An application has been launched",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "17",
"name": "launched",
"signature": "hs.application.watcher.launched",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.launching",
"desc": "An application is in the process of being launched",
"doc": "An application is in the process of being launched",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "13",
"name": "launching",
"signature": "hs.application.watcher.launching",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.new(fn) -> watcher",
"desc": "Creates an application event watcher",
"doc": "Creates an application event watcher\n\nParameters:\n * fn - A function that will be called when application events happen. It should accept three parameters:\n * A string containing the name of the application\n * An event type (see the constants defined above)\n * An `hs.application` object representing the application, or nil if the application couldn't be found\n\nReturns:\n * An `hs.application.watcher` object\n\nNotes:\n * If the function is called with an event type of `hs.application.watcher.terminated` then the application name parameter will be `nil` and the `hs.application` parameter, will only be useful for getting the UNIX process ID (i.e. the PID) of the application",
"examples": [],
"file": "extensions/application/libapplication_watcher.m",
"lineno": "142",
"name": "new",
"notes": [
" * If the function is called with an event type of `hs.application.watcher.terminated` then the application name parameter will be `nil` and the `hs.application` parameter, will only be useful for getting the UNIX process ID (i.e. the PID) of the application"
],
"parameters": [
" * fn - A function that will be called when application events happen. It should accept three parameters:\n * A string containing the name of the application\n * An event type (see the constants defined above)\n * An `hs.application` object representing the application, or nil if the application couldn't be found"
],
"returns": [
" * An `hs.application.watcher` object"
],
"signature": "hs.application.watcher.new(fn) -> watcher",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.application.watcher:start()",
"desc": "Starts the application watcher",
"doc": "Starts the application watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.application.watcher` object",
"examples": [],
"file": "extensions/application/libapplication_watcher.m",
"lineno": "224",
"name": "start",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.application.watcher` object"
],
"signature": "hs.application.watcher:start()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.watcher:stop()",
"desc": "Stops the application watcher",
"doc": "Stops the application watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.application.watcher` object",
"examples": [],
"file": "extensions/application/libapplication_watcher.m",
"lineno": "247",
"name": "stop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.application.watcher` object"
],
"signature": "hs.application.watcher:stop()",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.application.watcher.terminated",
"desc": "An application has been terminated",
"doc": "An application has been terminated",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "21",
"name": "terminated",
"signature": "hs.application.watcher.terminated",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.application.watcher.unhidden",
"desc": "An application has been unhidden",
"doc": "An application has been unhidden",
"file": "extensions/application/libapplication_watcher.m",
"lineno": "29",
"name": "unhidden",
"signature": "hs.application.watcher.unhidden",
"stripped_doc": "",
"type": "Constant"
}
],
"name": "hs.application.watcher",
"stripped_doc": "\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Markus Engelbrecht](https://github.com/mgee) and [Steven Degutis](https://github.com/sdegutis/).",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.audiodevice.allDevices() -> hs.audiodevice[]",
"desc": "Returns a list of all connected devices",
"doc": "Returns a list of all connected devices\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more audio devices connected to the system",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "173",
"name": "allDevices",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more audio devices connected to the system"
],
"signature": "hs.audiodevice.allDevices() -> hs.audiodevice[]",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.allInputDevices() -> audio[]",
"desc": "Returns a list of all connected input devices.",
"doc": "Returns a list of all connected input devices.\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more audio input devices connected to the system",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "141",
"name": "allInputDevices",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more audio input devices connected to the system"
],
"signature": "hs.audiodevice.allInputDevices() -> audio[]",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.allOutputDevices() -> hs.audiodevice[]",
"desc": "Returns a list of all connected output devices",
"doc": "Returns a list of all connected output devices\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more audio output devices connected to the system",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "128",
"name": "allOutputDevices",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more audio output devices connected to the system"
],
"signature": "hs.audiodevice.allOutputDevices() -> hs.audiodevice[]",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.current([input]) -> table",
"desc": "Fetch various metadata about the current default audio devices",
"doc": "Fetch various metadata about the current default audio devices\n\nParameters:\n * output - An optional boolean, true to fetch information about the default input device, false for output device. Defaults to false\n\nReturns:\n * A table with the following contents:\n```lua\n {\n name = defaultOutputDevice():name(),\n uid = module.defaultOutputDevice():uid(),\n muted = defaultOutputDevice():muted(),\n volume = defaultOutputDevice():volume(),\n device = defaultOutputDevice(),\n }\n```",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "15",
"name": "current",
"notes": [],
"parameters": [
" * output - An optional boolean, true to fetch information about the default input device, false for output device. Defaults to false"
],
"returns": [
" * A table with the following contents:",
"```lua",
" {",
" name = defaultOutputDevice():name(),",
" uid = module.defaultOutputDevice():uid(),",
" muted = defaultOutputDevice():muted(),",
" volume = defaultOutputDevice():volume(),",
" device = defaultOutputDevice(),",
" }",
"```"
],
"signature": "hs.audiodevice.current([input]) -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.defaultEffectDevice() -> audio or nil",
"desc": "Get the currently selected sound effect device",
"doc": "Get the currently selected sound effect device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice object, or nil if no suitable device could be found",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "315",
"name": "defaultEffectDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice object, or nil if no suitable device could be found"
],
"signature": "hs.audiodevice.defaultEffectDevice() -> audio or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.defaultInputDevice() -> audio or nil",
"desc": "Get the currently selected audio input device",
"doc": "Get the currently selected audio input device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice object, or nil if no suitable device could be found",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "284",
"name": "defaultInputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice object, or nil if no suitable device could be found"
],
"signature": "hs.audiodevice.defaultInputDevice() -> audio or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.defaultOutputDevice() -> audio or nil",
"desc": "Get the currently selected audio output device",
"doc": "Get the currently selected audio output device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice object, or nil if no suitable device could be found",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "253",
"name": "defaultOutputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice object, or nil if no suitable device could be found"
],
"signature": "hs.audiodevice.defaultOutputDevice() -> audio or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findDeviceByName(name) -> device or nil",
"desc": "Find an audio device by name",
"doc": "Find an audio device by name\n\nParameters:\n * name - A string containing the name of an audio device to search for\n\nReturns:\n * An `hs.audiodevice` object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "50",
"name": "findDeviceByName",
"notes": [],
"parameters": [
" * name - A string containing the name of an audio device to search for"
],
"returns": [
" * An `hs.audiodevice` object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findDeviceByName(name) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findDeviceByUID(uid) -> device or nil",
"desc": "Find an audio device by UID",
"doc": "Find an audio device by UID\n\nParameters:\n * uid - A string containing the UID of an audio device to search for\n\nReturns:\n * An `hs.audiodevice` object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "63",
"name": "findDeviceByUID",
"notes": [],
"parameters": [
" * uid - A string containing the UID of an audio device to search for"
],
"returns": [
" * An `hs.audiodevice` object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findDeviceByUID(uid) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findInputByName(name) -> device or nil",
"desc": "Find an audio input device by name",
"doc": "Find an audio input device by name\n\nParameters:\n * name - A string containing the name of an audio input device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "89",
"name": "findInputByName",
"notes": [],
"parameters": [
" * name - A string containing the name of an audio input device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findInputByName(name) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findInputByUID(uid) -> device or nil",
"desc": "Find an audio input device by UID",
"doc": "Find an audio input device by UID\n\nParameters:\n * name - A string containing the UID of an audio input device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "115",
"name": "findInputByUID",
"notes": [],
"parameters": [
" * name - A string containing the UID of an audio input device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findInputByUID(uid) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findOutputByName(name) -> device or nil",
"desc": "Find an audio output device by name",
"doc": "Find an audio output device by name\n\nParameters:\n * name - A string containing the name of an audio output device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "76",
"name": "findOutputByName",
"notes": [],
"parameters": [
" * name - A string containing the name of an audio output device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findOutputByName(name) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findOutputByUID(uid) -> device or nil",
"desc": "Find an audio output device by UID",
"doc": "Find an audio output device by UID\n\nParameters:\n * name - A string containing the UID of an audio output device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "102",
"name": "findOutputByUID",
"notes": [],
"parameters": [
" * name - A string containing the UID of an audio output device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findOutputByUID(uid) -> device or nil",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [
{
"def": "hs.audiodevice:allInputDataSources() -> hs.audiodevice.dataSource[] or nil",
"desc": "Gets all of the input data sources of an audio device",
"doc": "Gets all of the input data sources of an audio device\n\nParameters:\n * None\n\nReturns:\n * A list of hs.audiodevice.dataSource objects, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1499",
"name": "allInputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A list of hs.audiodevice.dataSource objects, or nil if an error occurred"
],
"signature": "hs.audiodevice:allInputDataSources() -> hs.audiodevice.dataSource[] or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:allOutputDataSources() -> hs.audiodevice.dataSource[] or nil",
"desc": "Gets all of the output data sources of an audio device",
"doc": "Gets all of the output data sources of an audio device\n\nParameters:\n * None\n\nReturns:\n * A list of hs.audiodevice.dataSource objects, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1446",
"name": "allOutputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A list of hs.audiodevice.dataSource objects, or nil if an error occurred"
],
"signature": "hs.audiodevice:allOutputDataSources() -> hs.audiodevice.dataSource[] or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:balance() -> number or nil",
"desc": "Get the current left/right balance of this audio device",
"doc": "Get the current left/right balance of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center), or nil if the audio device does not support balance\n\nNotes:\n * The return value will be a floating point number\n * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1067",
"name": "balance",
"notes": [
" * The return value will be a floating point number",
" * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center), or nil if the audio device does not support balance"
],
"signature": "hs.audiodevice:balance() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:currentInputDataSource() -> hs.audiodevice.dataSource object or nil",
"desc": "Gets the current input data source of an audio device",
"doc": "Gets the current input data source of an audio device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice.dataSource object, or nil if an error occurred\n\nNotes:\n * Before calling this method, you should check the result of hs.audiodevice:supportsInputDataSources()",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1372",
"name": "currentInputDataSource",
"notes": [
" * Before calling this method, you should check the result of hs.audiodevice:supportsInputDataSources()"
],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice.dataSource object, or nil if an error occurred"
],
"signature": "hs.audiodevice:currentInputDataSource() -> hs.audiodevice.dataSource object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:currentOutputDataSource() -> hs.audiodevice.dataSource object or nil",
"desc": "Gets the current output data source of an audio device",
"doc": "Gets the current output data source of an audio device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice.dataSource object, or nil if an error occurred\n\nNotes:\n * Before calling this method, you should check the result of hs.audiodevice:supportsOutputDataSources()",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1409",
"name": "currentOutputDataSource",
"notes": [
" * Before calling this method, you should check the result of hs.audiodevice:supportsOutputDataSources()"
],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice.dataSource object, or nil if an error occurred"
],
"signature": "hs.audiodevice:currentOutputDataSource() -> hs.audiodevice.dataSource object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:inputMuted() -> bool or nil",
"desc": "Get the Input mutedness state of the audio device",
"doc": "Get the Input mutedness state of the audio device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device's Input is muted. False if it's not muted, nil if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "563",
"name": "inputMuted",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device's Input is muted. False if it's not muted, nil if it does not support muting"
],
"signature": "hs.audiodevice:inputMuted() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:inputVolume() -> number or nil",
"desc": "Get the current input volume of this audio device",
"doc": "Get the current input volume of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0 and 100, representing the input volume percentage, or nil if the audio device does not support input volume levels\n\nNotes:\n * The return value will be a floating point number",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "794",
"name": "inputVolume",
"notes": [
" * The return value will be a floating point number"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0 and 100, representing the input volume percentage, or nil if the audio device does not support input volume levels"
],
"signature": "hs.audiodevice:inputVolume() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:inUse() -> bool or nil",
"desc": "Check if the audio device is in use",
"doc": "Check if the audio device is in use\n\nParameters:\n * None\n\nReturns:\n * True if the audio device is in use, False if not. nil if an error occurred.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "521",
"name": "inUse",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device is in use, False if not. nil if an error occurred."
],
"signature": "hs.audiodevice:inUse() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:isInputDevice() -> boolean",
"desc": "Determins if an audio device is an input device",
"doc": "Determins if an audio device is an input device\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device is an input device, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1185",
"name": "isInputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device is an input device, false if not"
],
"signature": "hs.audiodevice:isInputDevice() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:isOutputDevice() -> boolean",
"desc": "Determins if an audio device is an output device",
"doc": "Determins if an audio device is an output device\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device is an output device, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1165",
"name": "isOutputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device is an output device, false if not"
],
"signature": "hs.audiodevice:isOutputDevice() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:jackConnected() -> boolean or nil",
"desc": "Determines whether an audio jack (e.g. headphones) is connected to an audio device",
"doc": "Determines whether an audio jack (e.g. headphones) is connected to an audio device\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if a jack is connected, false if not, or nil if the device does not support jack sense",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1284",
"name": "jackConnected",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if a jack is connected, false if not, or nil if the device does not support jack sense"
],
"signature": "hs.audiodevice:jackConnected() -> boolean or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:muted() -> bool or nil",
"desc": "Get the mutedness state of the audio device",
"doc": "Get the mutedness state of the audio device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device is muted, False if it is not muted, nil if it does not support muting\n\nNotes:\n * If a device is capable of both input and output, this method will prefer the output. See `:inputMuted()` and `:outputMuted()` for specific variants.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "635",
"name": "muted",
"notes": [
" * If a device is capable of both input and output, this method will prefer the output. See `:inputMuted()` and `:outputMuted()` for specific variants."
],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device is muted, False if it is not muted, nil if it does not support muting"
],
"signature": "hs.audiodevice:muted() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:name() -> string or nil",
"desc": "Get the name of the audio device",
"doc": "Get the name of the audio device\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the audio device, or nil if it has no name",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "448",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the audio device, or nil if it has no name"
],
"signature": "hs.audiodevice:name() -> string or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:outputMuted() -> bool or nil",
"desc": "Get the Output mutedness state of the audio device",
"doc": "Get the Output mutedness state of the audio device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device's Output is muted. False if it's not muted, nil if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "599",
"name": "outputMuted",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device's Output is muted. False if it's not muted, nil if it does not support muting"
],
"signature": "hs.audiodevice:outputMuted() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:outputVolume() -> number or nil",
"desc": "Get the current output volume of this audio device",
"doc": "Get the current output volume of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0 and 100, representing the output volume percentage, or nil if the audio device does not support output volume levels\n\nNotes:\n * The return value will be a floating point number",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "835",
"name": "outputVolume",
"notes": [
" * The return value will be a floating point number"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0 and 100, representing the output volume percentage, or nil if the audio device does not support output volume levels"
],
"signature": "hs.audiodevice:outputVolume() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setBalance(level) -> bool",
"desc": "Set the balance of this audio device",
"doc": "Set the balance of this audio device\n\nParameters:\n * level - A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center)\n\nReturns:\n * True if the balance was set, false if the audio device does not support setting a balance.\n\nNotes:\n * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1112",
"name": "setBalance",
"notes": [
" * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`"
],
"parameters": [
" * level - A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center)"
],
"returns": [
" * True if the balance was set, false if the audio device does not support setting a balance."
],
"signature": "hs.audiodevice:setBalance(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setDefaultEffectDevice() -> bool",
"desc": "Selects this device as the audio output device for system sound effects",
"doc": "Selects this device as the audio output device for system sound effects\n\nParameters:\n * None\n\nReturns:\n * True if the audio device was successfully selected, otherwise false.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "382",
"name": "setDefaultEffectDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device was successfully selected, otherwise false."
],
"signature": "hs.audiodevice:setDefaultEffectDevice() -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setDefaultInputDevice() -> bool",
"desc": "Selects this device as the system's audio input device",
"doc": "Selects this device as the system's audio input device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device was successfully selected, otherwise false.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "415",
"name": "setDefaultInputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device was successfully selected, otherwise false."
],
"signature": "hs.audiodevice:setDefaultInputDevice() -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setDefaultOutputDevice() -> bool",
"desc": "Selects this device as the system's audio output device",
"doc": "Selects this device as the system's audio output device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device was successfully selected, otherwise false.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "349",
"name": "setDefaultOutputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device was successfully selected, otherwise false."
],
"signature": "hs.audiodevice:setDefaultOutputDevice() -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setInputMuted(state) -> bool",
"desc": "Set the mutedness state of the Input of the audio device",
"doc": "Set the mutedness state of the Input of the audio device\n\nParameters:\n * state - A boolean value. True to mute the device, False to unmute it\n\nReturns:\n * True if the device's Input mutedness state was set, or False if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "678",
"name": "setInputMuted",
"notes": [],
"parameters": [
" * state - A boolean value. True to mute the device, False to unmute it"
],
"returns": [
" * True if the device's Input mutedness state was set, or False if it does not support muting"
],
"signature": "hs.audiodevice:setInputMuted(state) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setInputVolume(level) -> bool",
"desc": "Set the input volume of this audio device",
"doc": "Set the input volume of this audio device\n\nParameters:\n * level - A number between 0 and 100, representing the input volume as a percentage\n\nReturns:\n * True if the volume was set, false if the audio device does not support setting an input volume level\n\nNotes:\n * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "921",
"name": "setInputVolume",
"notes": [
" * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments"
],
"parameters": [
" * level - A number between 0 and 100, representing the input volume as a percentage"
],
"returns": [
" * True if the volume was set, false if the audio device does not support setting an input volume level"
],
"signature": "hs.audiodevice:setInputVolume(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setMuted(state) -> bool",
"desc": "Set the mutedness state of the audio device",
"doc": "Set the mutedness state of the audio device\n\nParameters:\n * state - A boolean value. True to mute the device, False to unmute it\n\nReturns:\n * True if the device's mutedness state was set, or False if it does not support muting\n\nNotes:\n * If a device is capable of both input and output, this method will prefer the output. See `:inputSetMuted()` and `:outputSetMuted()` for specific variants.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "751",
"name": "setMuted",
"notes": [
" * If a device is capable of both input and output, this method will prefer the output. See `:inputSetMuted()` and `:outputSetMuted()` for specific variants."
],
"parameters": [
" * state - A boolean value. True to mute the device, False to unmute it"
],
"returns": [
" * True if the device's mutedness state was set, or False if it does not support muting"
],
"signature": "hs.audiodevice:setMuted(state) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setOutputMuted(state) -> bool",
"desc": "Set the mutedness state of the Output of the audio device",
"doc": "Set the mutedness state of the Output of the audio device\n\nParameters:\n * state - A boolean value. True to mute the device, False to unmute it\n\nReturns:\n * True if the device's Output mutedness state was set, or False if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "714",
"name": "setOutputMuted",
"notes": [],
"parameters": [
" * state - A boolean value. True to mute the device, False to unmute it"
],
"returns": [
" * True if the device's Output mutedness state was set, or False if it does not support muting"
],
"signature": "hs.audiodevice:setOutputMuted(state) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setOutputVolume(level) -> bool",
"desc": "Set the output volume of this audio device",
"doc": "Set the output volume of this audio device\n\nParameters:\n * level - A number between 0 and 100, representing the output volume as a percentage\n\nReturns:\n * True if the volume was set, false if the audio device does not support setting an output volume level\n\nNotes:\n * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "967",
"name": "setOutputVolume",
"notes": [
" * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments"
],
"parameters": [
" * level - A number between 0 and 100, representing the output volume as a percentage"
],
"returns": [
" * True if the volume was set, false if the audio device does not support setting an output volume level"
],
"signature": "hs.audiodevice:setOutputVolume(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setVolume(level) -> bool",
"desc": "Set the volume of this audio device",
"doc": "Set the volume of this audio device\n\nParameters:\n * level - A number between 0 and 100, representing the volume as a percentage\n\nReturns:\n * True if the volume was set, false if the audio device does not support setting a volume level.\n\nNotes:\n * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments.\n * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1013",
"name": "setVolume",
"notes": [
" * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments.",
" * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`"
],
"parameters": [
" * level - A number between 0 and 100, representing the volume as a percentage"
],
"returns": [
" * True if the volume was set, false if the audio device does not support setting a volume level."
],
"signature": "hs.audiodevice:setVolume(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:supportsInputDataSources() -> boolean",
"desc": "Determines whether an audio device supports input data sources",
"doc": "Determines whether an audio device supports input data sources\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device supports input data sources, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1318",
"name": "supportsInputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device supports input data sources, false if not"
],
"signature": "hs.audiodevice:supportsInputDataSources() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:supportsOutputDataSources() -> boolean",
"desc": "Determines whether an audio device supports output data sources",
"doc": "Determines whether an audio device supports output data sources\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device supports output data sources, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1345",
"name": "supportsOutputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device supports output data sources, false if not"
],
"signature": "hs.audiodevice:supportsOutputDataSources() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:transportType() -> string",
"desc": "Gets the hardware transport type of an audio device",
"doc": "Gets the hardware transport type of an audio device\n\nParameters:\n * None\n\nReturns:\n * A string containing the transport type, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1205",
"name": "transportType",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the transport type, or nil if an error occurred"
],
"signature": "hs.audiodevice:transportType() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:uid() -> string or nil",
"desc": "Get the unique identifier of the audio device",
"doc": "Get the unique identifier of the audio device\n\nParameters:\n * None\n\nReturns:\n * A string containing the UID of the audio device, or nil if it has no UID.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "482",
"name": "uid",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the UID of the audio device, or nil if it has no UID."
],
"signature": "hs.audiodevice:uid() -> string or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:volume() -> number or nil",
"desc": "Get the current volume of this audio device",
"doc": "Get the current volume of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0 and 100, representing the volume percentage, or nil if the audio device does not support volume levels\n\nNotes:\n * The return value will be a floating point number\n * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "876",
"name": "volume",
"notes": [
" * The return value will be a floating point number",
" * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0 and 100, representing the volume percentage, or nil if the audio device does not support volume levels"
],
"signature": "hs.audiodevice:volume() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherCallback(fn) -> hs.audiodevice",
"desc": "Sets or removes a callback function for an audio device watcher",
"doc": "Sets or removes a callback function for an audio device watcher\n\nParameters:\n * fn - A callback function that will be called when properties of this audio device change, or nil to remove an existing callback. The function should accept four arguments:\n * A string containing the UID of the audio device (see `hs.audiodevice.findDeviceByUID()`)\n * A string containing the name of the event. Possible values are:\n * vmvc - Volume changed\n * mute - Mute state changed\n * jack - Jack sense state changed (usually this means headphones were plugged/unplugged)\n * span - Stereo pan changed\n * diff - Device configuration changed (if you are caching audio device properties, this event indicates you should flush your cache)\n * gone - The device's \"in use\" status changed (ie another app started using the device, or stopped using it)\n * A string containing the scope of the event. Possible values are:\n * glob - This is a global event pertaining to the whole device\n * inpt - This is an event pertaining only to the input functions of the device\n * outp - This is an event pertaining only to the output functions of the device\n * A number containing the element of the event. Typical values are:\n * 0 - Typically this means the Master channel\n * 1 - Typically this means the Left channel\n * 2 - Typically this means the Right channel\n\nReturns:\n * The `hs.audiodevice` object\n\nNotes:\n * You will receive many events to your callback, so filtering on the name/scope/element arguments is vital. For example, on a stereo device, it is not uncommon to receive a `volm` event for each audio channel when the volume changes, or multiple `mute` events for channels. Dragging a volume slider in the system Sound preferences will produce a large number of `volm` events. Plugging/unplugging headphones may trigger `volm` events in addition to `jack` ones, etc.\n * If you need to use the `hs.audiodevice` object in your callback, use `hs.audiodevice.findDeviceByUID()` to obtain it fro the first callback argument",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1552",
"name": "watcherCallback",
"notes": [
" * You will receive many events to your callback, so filtering on the name/scope/element arguments is vital. For example, on a stereo device, it is not uncommon to receive a `volm` event for each audio channel when the volume changes, or multiple `mute` events for channels. Dragging a volume slider in the system Sound preferences will produce a large number of `volm` events. Plugging/unplugging headphones may trigger `volm` events in addition to `jack` ones, etc.",
" * If you need to use the `hs.audiodevice` object in your callback, use `hs.audiodevice.findDeviceByUID()` to obtain it fro the first callback argument"
],
"parameters": [
" * fn - A callback function that will be called when properties of this audio device change, or nil to remove an existing callback. The function should accept four arguments:\n * A string containing the UID of the audio device (see `hs.audiodevice.findDeviceByUID()`)\n * A string containing the name of the event. Possible values are:\n * vmvc - Volume changed\n * mute - Mute state changed\n * jack - Jack sense state changed (usually this means headphones were plugged/unplugged)\n * span - Stereo pan changed\n * diff - Device configuration changed (if you are caching audio device properties, this event indicates you should flush your cache)\n * gone - The device's \"in use\" status changed (ie another app started using the device, or stopped using it)\n * A string containing the scope of the event. Possible values are:\n * glob - This is a global event pertaining to the whole device\n * inpt - This is an event pertaining only to the input functions of the device\n * outp - This is an event pertaining only to the output functions of the device\n * A number containing the element of the event. Typical values are:\n * 0 - Typically this means the Master channel\n * 1 - Typically this means the Left channel\n * 2 - Typically this means the Right channel"
],
"returns": [
" * The `hs.audiodevice` object"
],
"signature": "hs.audiodevice:watcherCallback(fn) -> hs.audiodevice",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherIsRunning() -> boolean",
"desc": "Gets the status of the `hs.audiodevice` object watcher",
"doc": "Gets the status of the `hs.audiodevice` object watcher\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the watcher is running, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1698",
"name": "watcherIsRunning",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the watcher is running, false if not"
],
"signature": "hs.audiodevice:watcherIsRunning() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherStart() -> hs.audiodevice or nil",
"desc": "Starts the watcher on an `hs.audiodevice` object",
"doc": "Starts the watcher on an `hs.audiodevice` object\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice` object, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1608",
"name": "watcherStart",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice` object, or nil if an error occurred"
],
"signature": "hs.audiodevice:watcherStart() -> hs.audiodevice or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherStop() -> hs.audiodevice",
"desc": "Stops the watcher on an `hs.audiodevice` object",
"doc": "Stops the watcher on an `hs.audiodevice` object\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice` object",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1676",
"name": "watcherStop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice` object"
],
"signature": "hs.audiodevice:watcherStop() -> hs.audiodevice",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "Manipulate the system's audio devices",
"doc": "Manipulate the system's audio devices\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"items": [
{
"def": "hs.audiodevice.allDevices() -> hs.audiodevice[]",
"desc": "Returns a list of all connected devices",
"doc": "Returns a list of all connected devices\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more audio devices connected to the system",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "173",
"name": "allDevices",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more audio devices connected to the system"
],
"signature": "hs.audiodevice.allDevices() -> hs.audiodevice[]",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice:allInputDataSources() -> hs.audiodevice.dataSource[] or nil",
"desc": "Gets all of the input data sources of an audio device",
"doc": "Gets all of the input data sources of an audio device\n\nParameters:\n * None\n\nReturns:\n * A list of hs.audiodevice.dataSource objects, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1499",
"name": "allInputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A list of hs.audiodevice.dataSource objects, or nil if an error occurred"
],
"signature": "hs.audiodevice:allInputDataSources() -> hs.audiodevice.dataSource[] or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice.allInputDevices() -> audio[]",
"desc": "Returns a list of all connected input devices.",
"doc": "Returns a list of all connected input devices.\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more audio input devices connected to the system",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "141",
"name": "allInputDevices",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more audio input devices connected to the system"
],
"signature": "hs.audiodevice.allInputDevices() -> audio[]",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice:allOutputDataSources() -> hs.audiodevice.dataSource[] or nil",
"desc": "Gets all of the output data sources of an audio device",
"doc": "Gets all of the output data sources of an audio device\n\nParameters:\n * None\n\nReturns:\n * A list of hs.audiodevice.dataSource objects, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1446",
"name": "allOutputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A list of hs.audiodevice.dataSource objects, or nil if an error occurred"
],
"signature": "hs.audiodevice:allOutputDataSources() -> hs.audiodevice.dataSource[] or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice.allOutputDevices() -> hs.audiodevice[]",
"desc": "Returns a list of all connected output devices",
"doc": "Returns a list of all connected output devices\n\nParameters:\n * None\n\nReturns:\n * A table of zero or more audio output devices connected to the system",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "128",
"name": "allOutputDevices",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table of zero or more audio output devices connected to the system"
],
"signature": "hs.audiodevice.allOutputDevices() -> hs.audiodevice[]",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice:balance() -> number or nil",
"desc": "Get the current left/right balance of this audio device",
"doc": "Get the current left/right balance of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center), or nil if the audio device does not support balance\n\nNotes:\n * The return value will be a floating point number\n * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1067",
"name": "balance",
"notes": [
" * The return value will be a floating point number",
" * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center), or nil if the audio device does not support balance"
],
"signature": "hs.audiodevice:balance() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice.current([input]) -> table",
"desc": "Fetch various metadata about the current default audio devices",
"doc": "Fetch various metadata about the current default audio devices\n\nParameters:\n * output - An optional boolean, true to fetch information about the default input device, false for output device. Defaults to false\n\nReturns:\n * A table with the following contents:\n```lua\n {\n name = defaultOutputDevice():name(),\n uid = module.defaultOutputDevice():uid(),\n muted = defaultOutputDevice():muted(),\n volume = defaultOutputDevice():volume(),\n device = defaultOutputDevice(),\n }\n```",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "15",
"name": "current",
"notes": [],
"parameters": [
" * output - An optional boolean, true to fetch information about the default input device, false for output device. Defaults to false"
],
"returns": [
" * A table with the following contents:",
"```lua",
" {",
" name = defaultOutputDevice():name(),",
" uid = module.defaultOutputDevice():uid(),",
" muted = defaultOutputDevice():muted(),",
" volume = defaultOutputDevice():volume(),",
" device = defaultOutputDevice(),",
" }",
"```"
],
"signature": "hs.audiodevice.current([input]) -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice:currentInputDataSource() -> hs.audiodevice.dataSource object or nil",
"desc": "Gets the current input data source of an audio device",
"doc": "Gets the current input data source of an audio device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice.dataSource object, or nil if an error occurred\n\nNotes:\n * Before calling this method, you should check the result of hs.audiodevice:supportsInputDataSources()",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1372",
"name": "currentInputDataSource",
"notes": [
" * Before calling this method, you should check the result of hs.audiodevice:supportsInputDataSources()"
],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice.dataSource object, or nil if an error occurred"
],
"signature": "hs.audiodevice:currentInputDataSource() -> hs.audiodevice.dataSource object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:currentOutputDataSource() -> hs.audiodevice.dataSource object or nil",
"desc": "Gets the current output data source of an audio device",
"doc": "Gets the current output data source of an audio device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice.dataSource object, or nil if an error occurred\n\nNotes:\n * Before calling this method, you should check the result of hs.audiodevice:supportsOutputDataSources()",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1409",
"name": "currentOutputDataSource",
"notes": [
" * Before calling this method, you should check the result of hs.audiodevice:supportsOutputDataSources()"
],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice.dataSource object, or nil if an error occurred"
],
"signature": "hs.audiodevice:currentOutputDataSource() -> hs.audiodevice.dataSource object or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice.defaultEffectDevice() -> audio or nil",
"desc": "Get the currently selected sound effect device",
"doc": "Get the currently selected sound effect device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice object, or nil if no suitable device could be found",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "315",
"name": "defaultEffectDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice object, or nil if no suitable device could be found"
],
"signature": "hs.audiodevice.defaultEffectDevice() -> audio or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.defaultInputDevice() -> audio or nil",
"desc": "Get the currently selected audio input device",
"doc": "Get the currently selected audio input device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice object, or nil if no suitable device could be found",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "284",
"name": "defaultInputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice object, or nil if no suitable device could be found"
],
"signature": "hs.audiodevice.defaultInputDevice() -> audio or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.defaultOutputDevice() -> audio or nil",
"desc": "Get the currently selected audio output device",
"doc": "Get the currently selected audio output device\n\nParameters:\n * None\n\nReturns:\n * An hs.audiodevice object, or nil if no suitable device could be found",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "253",
"name": "defaultOutputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An hs.audiodevice object, or nil if no suitable device could be found"
],
"signature": "hs.audiodevice.defaultOutputDevice() -> audio or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findDeviceByName(name) -> device or nil",
"desc": "Find an audio device by name",
"doc": "Find an audio device by name\n\nParameters:\n * name - A string containing the name of an audio device to search for\n\nReturns:\n * An `hs.audiodevice` object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "50",
"name": "findDeviceByName",
"notes": [],
"parameters": [
" * name - A string containing the name of an audio device to search for"
],
"returns": [
" * An `hs.audiodevice` object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findDeviceByName(name) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findDeviceByUID(uid) -> device or nil",
"desc": "Find an audio device by UID",
"doc": "Find an audio device by UID\n\nParameters:\n * uid - A string containing the UID of an audio device to search for\n\nReturns:\n * An `hs.audiodevice` object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "63",
"name": "findDeviceByUID",
"notes": [],
"parameters": [
" * uid - A string containing the UID of an audio device to search for"
],
"returns": [
" * An `hs.audiodevice` object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findDeviceByUID(uid) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findInputByName(name) -> device or nil",
"desc": "Find an audio input device by name",
"doc": "Find an audio input device by name\n\nParameters:\n * name - A string containing the name of an audio input device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "89",
"name": "findInputByName",
"notes": [],
"parameters": [
" * name - A string containing the name of an audio input device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findInputByName(name) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findInputByUID(uid) -> device or nil",
"desc": "Find an audio input device by UID",
"doc": "Find an audio input device by UID\n\nParameters:\n * name - A string containing the UID of an audio input device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "115",
"name": "findInputByUID",
"notes": [],
"parameters": [
" * name - A string containing the UID of an audio input device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findInputByUID(uid) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findOutputByName(name) -> device or nil",
"desc": "Find an audio output device by name",
"doc": "Find an audio output device by name\n\nParameters:\n * name - A string containing the name of an audio output device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "76",
"name": "findOutputByName",
"notes": [],
"parameters": [
" * name - A string containing the name of an audio output device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findOutputByName(name) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.findOutputByUID(uid) -> device or nil",
"desc": "Find an audio output device by UID",
"doc": "Find an audio output device by UID\n\nParameters:\n * name - A string containing the UID of an audio output device to search for\n\nReturns:\n * An hs.audiodevice object or nil if the device could not be found",
"examples": [],
"file": "extensions/audiodevice/audiodevice.lua",
"lineno": "102",
"name": "findOutputByUID",
"notes": [],
"parameters": [
" * name - A string containing the UID of an audio output device to search for"
],
"returns": [
" * An hs.audiodevice object or nil if the device could not be found"
],
"signature": "hs.audiodevice.findOutputByUID(uid) -> device or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice:inputMuted() -> bool or nil",
"desc": "Get the Input mutedness state of the audio device",
"doc": "Get the Input mutedness state of the audio device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device's Input is muted. False if it's not muted, nil if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "563",
"name": "inputMuted",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device's Input is muted. False if it's not muted, nil if it does not support muting"
],
"signature": "hs.audiodevice:inputMuted() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:inputVolume() -> number or nil",
"desc": "Get the current input volume of this audio device",
"doc": "Get the current input volume of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0 and 100, representing the input volume percentage, or nil if the audio device does not support input volume levels\n\nNotes:\n * The return value will be a floating point number",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "794",
"name": "inputVolume",
"notes": [
" * The return value will be a floating point number"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0 and 100, representing the input volume percentage, or nil if the audio device does not support input volume levels"
],
"signature": "hs.audiodevice:inputVolume() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:inUse() -> bool or nil",
"desc": "Check if the audio device is in use",
"doc": "Check if the audio device is in use\n\nParameters:\n * None\n\nReturns:\n * True if the audio device is in use, False if not. nil if an error occurred.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "521",
"name": "inUse",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device is in use, False if not. nil if an error occurred."
],
"signature": "hs.audiodevice:inUse() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:isInputDevice() -> boolean",
"desc": "Determins if an audio device is an input device",
"doc": "Determins if an audio device is an input device\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device is an input device, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1185",
"name": "isInputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device is an input device, false if not"
],
"signature": "hs.audiodevice:isInputDevice() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:isOutputDevice() -> boolean",
"desc": "Determins if an audio device is an output device",
"doc": "Determins if an audio device is an output device\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device is an output device, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1165",
"name": "isOutputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device is an output device, false if not"
],
"signature": "hs.audiodevice:isOutputDevice() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:jackConnected() -> boolean or nil",
"desc": "Determines whether an audio jack (e.g. headphones) is connected to an audio device",
"doc": "Determines whether an audio jack (e.g. headphones) is connected to an audio device\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if a jack is connected, false if not, or nil if the device does not support jack sense",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1284",
"name": "jackConnected",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if a jack is connected, false if not, or nil if the device does not support jack sense"
],
"signature": "hs.audiodevice:jackConnected() -> boolean or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:muted() -> bool or nil",
"desc": "Get the mutedness state of the audio device",
"doc": "Get the mutedness state of the audio device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device is muted, False if it is not muted, nil if it does not support muting\n\nNotes:\n * If a device is capable of both input and output, this method will prefer the output. See `:inputMuted()` and `:outputMuted()` for specific variants.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "635",
"name": "muted",
"notes": [
" * If a device is capable of both input and output, this method will prefer the output. See `:inputMuted()` and `:outputMuted()` for specific variants."
],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device is muted, False if it is not muted, nil if it does not support muting"
],
"signature": "hs.audiodevice:muted() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:name() -> string or nil",
"desc": "Get the name of the audio device",
"doc": "Get the name of the audio device\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the audio device, or nil if it has no name",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "448",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the audio device, or nil if it has no name"
],
"signature": "hs.audiodevice:name() -> string or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:outputMuted() -> bool or nil",
"desc": "Get the Output mutedness state of the audio device",
"doc": "Get the Output mutedness state of the audio device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device's Output is muted. False if it's not muted, nil if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "599",
"name": "outputMuted",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device's Output is muted. False if it's not muted, nil if it does not support muting"
],
"signature": "hs.audiodevice:outputMuted() -> bool or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:outputVolume() -> number or nil",
"desc": "Get the current output volume of this audio device",
"doc": "Get the current output volume of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0 and 100, representing the output volume percentage, or nil if the audio device does not support output volume levels\n\nNotes:\n * The return value will be a floating point number",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "835",
"name": "outputVolume",
"notes": [
" * The return value will be a floating point number"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0 and 100, representing the output volume percentage, or nil if the audio device does not support output volume levels"
],
"signature": "hs.audiodevice:outputVolume() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setBalance(level) -> bool",
"desc": "Set the balance of this audio device",
"doc": "Set the balance of this audio device\n\nParameters:\n * level - A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center)\n\nReturns:\n * True if the balance was set, false if the audio device does not support setting a balance.\n\nNotes:\n * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1112",
"name": "setBalance",
"notes": [
" * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`"
],
"parameters": [
" * level - A number between 0.0 and 1.0, representing the balance (0.0 for full left, 1.0 for full right, 0.5 for center)"
],
"returns": [
" * True if the balance was set, false if the audio device does not support setting a balance."
],
"signature": "hs.audiodevice:setBalance(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setDefaultEffectDevice() -> bool",
"desc": "Selects this device as the audio output device for system sound effects",
"doc": "Selects this device as the audio output device for system sound effects\n\nParameters:\n * None\n\nReturns:\n * True if the audio device was successfully selected, otherwise false.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "382",
"name": "setDefaultEffectDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device was successfully selected, otherwise false."
],
"signature": "hs.audiodevice:setDefaultEffectDevice() -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setDefaultInputDevice() -> bool",
"desc": "Selects this device as the system's audio input device",
"doc": "Selects this device as the system's audio input device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device was successfully selected, otherwise false.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "415",
"name": "setDefaultInputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device was successfully selected, otherwise false."
],
"signature": "hs.audiodevice:setDefaultInputDevice() -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setDefaultOutputDevice() -> bool",
"desc": "Selects this device as the system's audio output device",
"doc": "Selects this device as the system's audio output device\n\nParameters:\n * None\n\nReturns:\n * True if the audio device was successfully selected, otherwise false.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "349",
"name": "setDefaultOutputDevice",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the audio device was successfully selected, otherwise false."
],
"signature": "hs.audiodevice:setDefaultOutputDevice() -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setInputMuted(state) -> bool",
"desc": "Set the mutedness state of the Input of the audio device",
"doc": "Set the mutedness state of the Input of the audio device\n\nParameters:\n * state - A boolean value. True to mute the device, False to unmute it\n\nReturns:\n * True if the device's Input mutedness state was set, or False if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "678",
"name": "setInputMuted",
"notes": [],
"parameters": [
" * state - A boolean value. True to mute the device, False to unmute it"
],
"returns": [
" * True if the device's Input mutedness state was set, or False if it does not support muting"
],
"signature": "hs.audiodevice:setInputMuted(state) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setInputVolume(level) -> bool",
"desc": "Set the input volume of this audio device",
"doc": "Set the input volume of this audio device\n\nParameters:\n * level - A number between 0 and 100, representing the input volume as a percentage\n\nReturns:\n * True if the volume was set, false if the audio device does not support setting an input volume level\n\nNotes:\n * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "921",
"name": "setInputVolume",
"notes": [
" * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments"
],
"parameters": [
" * level - A number between 0 and 100, representing the input volume as a percentage"
],
"returns": [
" * True if the volume was set, false if the audio device does not support setting an input volume level"
],
"signature": "hs.audiodevice:setInputVolume(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setMuted(state) -> bool",
"desc": "Set the mutedness state of the audio device",
"doc": "Set the mutedness state of the audio device\n\nParameters:\n * state - A boolean value. True to mute the device, False to unmute it\n\nReturns:\n * True if the device's mutedness state was set, or False if it does not support muting\n\nNotes:\n * If a device is capable of both input and output, this method will prefer the output. See `:inputSetMuted()` and `:outputSetMuted()` for specific variants.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "751",
"name": "setMuted",
"notes": [
" * If a device is capable of both input and output, this method will prefer the output. See `:inputSetMuted()` and `:outputSetMuted()` for specific variants."
],
"parameters": [
" * state - A boolean value. True to mute the device, False to unmute it"
],
"returns": [
" * True if the device's mutedness state was set, or False if it does not support muting"
],
"signature": "hs.audiodevice:setMuted(state) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setOutputMuted(state) -> bool",
"desc": "Set the mutedness state of the Output of the audio device",
"doc": "Set the mutedness state of the Output of the audio device\n\nParameters:\n * state - A boolean value. True to mute the device, False to unmute it\n\nReturns:\n * True if the device's Output mutedness state was set, or False if it does not support muting",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "714",
"name": "setOutputMuted",
"notes": [],
"parameters": [
" * state - A boolean value. True to mute the device, False to unmute it"
],
"returns": [
" * True if the device's Output mutedness state was set, or False if it does not support muting"
],
"signature": "hs.audiodevice:setOutputMuted(state) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setOutputVolume(level) -> bool",
"desc": "Set the output volume of this audio device",
"doc": "Set the output volume of this audio device\n\nParameters:\n * level - A number between 0 and 100, representing the output volume as a percentage\n\nReturns:\n * True if the volume was set, false if the audio device does not support setting an output volume level\n\nNotes:\n * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "967",
"name": "setOutputVolume",
"notes": [
" * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments"
],
"parameters": [
" * level - A number between 0 and 100, representing the output volume as a percentage"
],
"returns": [
" * True if the volume was set, false if the audio device does not support setting an output volume level"
],
"signature": "hs.audiodevice:setOutputVolume(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:setVolume(level) -> bool",
"desc": "Set the volume of this audio device",
"doc": "Set the volume of this audio device\n\nParameters:\n * level - A number between 0 and 100, representing the volume as a percentage\n\nReturns:\n * True if the volume was set, false if the audio device does not support setting a volume level.\n\nNotes:\n * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments.\n * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1013",
"name": "setVolume",
"notes": [
" * The volume level is a floating point number. Depending on your audio hardware, it may not be possible to increase volume in single digit increments.",
" * This method will inspect the device to determine if it is an input or output device, and set the appropriate volume. For devices that are both input and output devices, see `:setInputVolume()` and `:setOutputVolume()`"
],
"parameters": [
" * level - A number between 0 and 100, representing the volume as a percentage"
],
"returns": [
" * True if the volume was set, false if the audio device does not support setting a volume level."
],
"signature": "hs.audiodevice:setVolume(level) -> bool",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:supportsInputDataSources() -> boolean",
"desc": "Determines whether an audio device supports input data sources",
"doc": "Determines whether an audio device supports input data sources\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device supports input data sources, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1318",
"name": "supportsInputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device supports input data sources, false if not"
],
"signature": "hs.audiodevice:supportsInputDataSources() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:supportsOutputDataSources() -> boolean",
"desc": "Determines whether an audio device supports output data sources",
"doc": "Determines whether an audio device supports output data sources\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the device supports output data sources, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1345",
"name": "supportsOutputDataSources",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the device supports output data sources, false if not"
],
"signature": "hs.audiodevice:supportsOutputDataSources() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:transportType() -> string",
"desc": "Gets the hardware transport type of an audio device",
"doc": "Gets the hardware transport type of an audio device\n\nParameters:\n * None\n\nReturns:\n * A string containing the transport type, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1205",
"name": "transportType",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the transport type, or nil if an error occurred"
],
"signature": "hs.audiodevice:transportType() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:uid() -> string or nil",
"desc": "Get the unique identifier of the audio device",
"doc": "Get the unique identifier of the audio device\n\nParameters:\n * None\n\nReturns:\n * A string containing the UID of the audio device, or nil if it has no UID.",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "482",
"name": "uid",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the UID of the audio device, or nil if it has no UID."
],
"signature": "hs.audiodevice:uid() -> string or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:volume() -> number or nil",
"desc": "Get the current volume of this audio device",
"doc": "Get the current volume of this audio device\n\nParameters:\n * None\n\nReturns:\n * A number between 0 and 100, representing the volume percentage, or nil if the audio device does not support volume levels\n\nNotes:\n * The return value will be a floating point number\n * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "876",
"name": "volume",
"notes": [
" * The return value will be a floating point number",
" * This method will inspect the device to determine if it is an input or output device, and return the appropriate volume. For devices that are both input and output devices, see `:inputVolume()` and `:outputVolume()`"
],
"parameters": [
" * None"
],
"returns": [
" * A number between 0 and 100, representing the volume percentage, or nil if the audio device does not support volume levels"
],
"signature": "hs.audiodevice:volume() -> number or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherCallback(fn) -> hs.audiodevice",
"desc": "Sets or removes a callback function for an audio device watcher",
"doc": "Sets or removes a callback function for an audio device watcher\n\nParameters:\n * fn - A callback function that will be called when properties of this audio device change, or nil to remove an existing callback. The function should accept four arguments:\n * A string containing the UID of the audio device (see `hs.audiodevice.findDeviceByUID()`)\n * A string containing the name of the event. Possible values are:\n * vmvc - Volume changed\n * mute - Mute state changed\n * jack - Jack sense state changed (usually this means headphones were plugged/unplugged)\n * span - Stereo pan changed\n * diff - Device configuration changed (if you are caching audio device properties, this event indicates you should flush your cache)\n * gone - The device's \"in use\" status changed (ie another app started using the device, or stopped using it)\n * A string containing the scope of the event. Possible values are:\n * glob - This is a global event pertaining to the whole device\n * inpt - This is an event pertaining only to the input functions of the device\n * outp - This is an event pertaining only to the output functions of the device\n * A number containing the element of the event. Typical values are:\n * 0 - Typically this means the Master channel\n * 1 - Typically this means the Left channel\n * 2 - Typically this means the Right channel\n\nReturns:\n * The `hs.audiodevice` object\n\nNotes:\n * You will receive many events to your callback, so filtering on the name/scope/element arguments is vital. For example, on a stereo device, it is not uncommon to receive a `volm` event for each audio channel when the volume changes, or multiple `mute` events for channels. Dragging a volume slider in the system Sound preferences will produce a large number of `volm` events. Plugging/unplugging headphones may trigger `volm` events in addition to `jack` ones, etc.\n * If you need to use the `hs.audiodevice` object in your callback, use `hs.audiodevice.findDeviceByUID()` to obtain it fro the first callback argument",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1552",
"name": "watcherCallback",
"notes": [
" * You will receive many events to your callback, so filtering on the name/scope/element arguments is vital. For example, on a stereo device, it is not uncommon to receive a `volm` event for each audio channel when the volume changes, or multiple `mute` events for channels. Dragging a volume slider in the system Sound preferences will produce a large number of `volm` events. Plugging/unplugging headphones may trigger `volm` events in addition to `jack` ones, etc.",
" * If you need to use the `hs.audiodevice` object in your callback, use `hs.audiodevice.findDeviceByUID()` to obtain it fro the first callback argument"
],
"parameters": [
" * fn - A callback function that will be called when properties of this audio device change, or nil to remove an existing callback. The function should accept four arguments:\n * A string containing the UID of the audio device (see `hs.audiodevice.findDeviceByUID()`)\n * A string containing the name of the event. Possible values are:\n * vmvc - Volume changed\n * mute - Mute state changed\n * jack - Jack sense state changed (usually this means headphones were plugged/unplugged)\n * span - Stereo pan changed\n * diff - Device configuration changed (if you are caching audio device properties, this event indicates you should flush your cache)\n * gone - The device's \"in use\" status changed (ie another app started using the device, or stopped using it)\n * A string containing the scope of the event. Possible values are:\n * glob - This is a global event pertaining to the whole device\n * inpt - This is an event pertaining only to the input functions of the device\n * outp - This is an event pertaining only to the output functions of the device\n * A number containing the element of the event. Typical values are:\n * 0 - Typically this means the Master channel\n * 1 - Typically this means the Left channel\n * 2 - Typically this means the Right channel"
],
"returns": [
" * The `hs.audiodevice` object"
],
"signature": "hs.audiodevice:watcherCallback(fn) -> hs.audiodevice",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherIsRunning() -> boolean",
"desc": "Gets the status of the `hs.audiodevice` object watcher",
"doc": "Gets the status of the `hs.audiodevice` object watcher\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the watcher is running, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1698",
"name": "watcherIsRunning",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the watcher is running, false if not"
],
"signature": "hs.audiodevice:watcherIsRunning() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherStart() -> hs.audiodevice or nil",
"desc": "Starts the watcher on an `hs.audiodevice` object",
"doc": "Starts the watcher on an `hs.audiodevice` object\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice` object, or nil if an error occurred",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1608",
"name": "watcherStart",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice` object, or nil if an error occurred"
],
"signature": "hs.audiodevice:watcherStart() -> hs.audiodevice or nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice:watcherStop() -> hs.audiodevice",
"desc": "Stops the watcher on an `hs.audiodevice` object",
"doc": "Stops the watcher on an `hs.audiodevice` object\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice` object",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1676",
"name": "watcherStop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice` object"
],
"signature": "hs.audiodevice:watcherStop() -> hs.audiodevice",
"stripped_doc": "",
"type": "Method"
}
],
"name": "hs.audiodevice",
"stripped_doc": "\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"submodules": [
"datasource",
"watcher"
],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "hs.audiodevice.datasource:name() -> string",
"desc": "Gets the name of an audio device datasource",
"doc": "Gets the name of an audio device datasource\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the datasource",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1806",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the datasource"
],
"signature": "hs.audiodevice.datasource:name() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice.datasource:setDefault() -> hs.audiodevice.datasource",
"desc": "Sets the audio device datasource as the default",
"doc": "Sets the audio device datasource as the default\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice.datasource` object",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1827",
"name": "setDefault",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice.datasource` object"
],
"signature": "hs.audiodevice.datasource:setDefault() -> hs.audiodevice.datasource",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "Inspect/manipulate the data sources of an audio device",
"doc": "Inspect/manipulate the data sources of an audio device\n\nNote: These objects are obtained from the methods on an `hs.audiodevice` object",
"items": [
{
"def": "hs.audiodevice.datasource:name() -> string",
"desc": "Gets the name of an audio device datasource",
"doc": "Gets the name of an audio device datasource\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the datasource",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1806",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the datasource"
],
"signature": "hs.audiodevice.datasource:name() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.audiodevice.datasource:setDefault() -> hs.audiodevice.datasource",
"desc": "Sets the audio device datasource as the default",
"doc": "Sets the audio device datasource as the default\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice.datasource` object",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice.m",
"lineno": "1827",
"name": "setDefault",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice.datasource` object"
],
"signature": "hs.audiodevice.datasource:setDefault() -> hs.audiodevice.datasource",
"stripped_doc": "",
"type": "Method"
}
],
"name": "hs.audiodevice.datasource",
"stripped_doc": "\nNote: These objects are obtained from the methods on an `hs.audiodevice` object",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.audiodevice.watcher.isRunning() -> boolean",
"desc": "Gets the status of the audio device watcher",
"doc": "Gets the status of the audio device watcher\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the watcher is running, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "198",
"name": "isRunning",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the watcher is running, false if not"
],
"signature": "hs.audiodevice.watcher.isRunning() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.watcher.setCallback(fn)",
"desc": "Sets the callback function for the audio device watcher",
"doc": "Sets the callback function for the audio device watcher\n\nParameters:\n * fn - A callback function, or nil to remove a previously set callback. The callback function should accept a single argument (see Notes below)\n\nReturns:\n * None\n\nNotes:\n * This watcher will call the callback when various audio device related events occur (e.g. an audio device appears/disappears, a system default audio device setting changes, etc)\n * To watch for changes within an audio device, see `hs.audiodevice:newWatcher()`\n * The callback function argument is a string which may be one of the following strings, but might also be a different string entirely:\n * dIn - Default audio input device setting changed (Note that there is a space character after `dIn`, because these values always have to be four characters long)\n * dOut - Default audio output device setting changed\n * sOut - Default system audio output setting changed (i.e. the device that system sound effects use. This may also be triggered by dOut, depending on the user's settings)\n * dev# - An audio device appeared or disappeared\n * The callback will be called for each individual audio device event received from the OS, so you may receive multiple events for a single physical action (e.g. unplugging the default audio device will cause `dOut` and `dev#` events, and possibly `sOut` too)\n * Passing nil will cause the watcher to stop if it is already running",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "77",
"name": "setCallback",
"notes": [
" * This watcher will call the callback when various audio device related events occur (e.g. an audio device appears/disappears, a system default audio device setting changes, etc)",
" * To watch for changes within an audio device, see `hs.audiodevice:newWatcher()`",
" * The callback function argument is a string which may be one of the following strings, but might also be a different string entirely:",
" * dIn - Default audio input device setting changed (Note that there is a space character after `dIn`, because these values always have to be four characters long)",
" * dOut - Default audio output device setting changed",
" * sOut - Default system audio output setting changed (i.e. the device that system sound effects use. This may also be triggered by dOut, depending on the user's settings)",
" * dev# - An audio device appeared or disappeared",
" * The callback will be called for each individual audio device event received from the OS, so you may receive multiple events for a single physical action (e.g. unplugging the default audio device will cause `dOut` and `dev#` events, and possibly `sOut` too)",
" * Passing nil will cause the watcher to stop if it is already running"
],
"parameters": [
" * fn - A callback function, or nil to remove a previously set callback. The callback function should accept a single argument (see Notes below)"
],
"returns": [
" * None"
],
"signature": "hs.audiodevice.watcher.setCallback(fn)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.watcher.start()",
"desc": "Starts the audio device watcher",
"doc": "Starts the audio device watcher\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "128",
"name": "start",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.audiodevice.watcher.start()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.watcher.stop() -> hs.audiodevice.watcher",
"desc": "Stops the audio device watcher",
"doc": "Stops the audio device watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice.watcher` object",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "166",
"name": "stop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice.watcher` object"
],
"signature": "hs.audiodevice.watcher.stop() -> hs.audiodevice.watcher",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "Watch for system level audio hardware events",
"doc": "Watch for system level audio hardware events",
"items": [
{
"def": "hs.audiodevice.watcher.isRunning() -> boolean",
"desc": "Gets the status of the audio device watcher",
"doc": "Gets the status of the audio device watcher\n\nParameters:\n * None\n\nReturns:\n * A boolean, true if the watcher is running, false if not",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "198",
"name": "isRunning",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A boolean, true if the watcher is running, false if not"
],
"signature": "hs.audiodevice.watcher.isRunning() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.watcher.setCallback(fn)",
"desc": "Sets the callback function for the audio device watcher",
"doc": "Sets the callback function for the audio device watcher\n\nParameters:\n * fn - A callback function, or nil to remove a previously set callback. The callback function should accept a single argument (see Notes below)\n\nReturns:\n * None\n\nNotes:\n * This watcher will call the callback when various audio device related events occur (e.g. an audio device appears/disappears, a system default audio device setting changes, etc)\n * To watch for changes within an audio device, see `hs.audiodevice:newWatcher()`\n * The callback function argument is a string which may be one of the following strings, but might also be a different string entirely:\n * dIn - Default audio input device setting changed (Note that there is a space character after `dIn`, because these values always have to be four characters long)\n * dOut - Default audio output device setting changed\n * sOut - Default system audio output setting changed (i.e. the device that system sound effects use. This may also be triggered by dOut, depending on the user's settings)\n * dev# - An audio device appeared or disappeared\n * The callback will be called for each individual audio device event received from the OS, so you may receive multiple events for a single physical action (e.g. unplugging the default audio device will cause `dOut` and `dev#` events, and possibly `sOut` too)\n * Passing nil will cause the watcher to stop if it is already running",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "77",
"name": "setCallback",
"notes": [
" * This watcher will call the callback when various audio device related events occur (e.g. an audio device appears/disappears, a system default audio device setting changes, etc)",
" * To watch for changes within an audio device, see `hs.audiodevice:newWatcher()`",
" * The callback function argument is a string which may be one of the following strings, but might also be a different string entirely:",
" * dIn - Default audio input device setting changed (Note that there is a space character after `dIn`, because these values always have to be four characters long)",
" * dOut - Default audio output device setting changed",
" * sOut - Default system audio output setting changed (i.e. the device that system sound effects use. This may also be triggered by dOut, depending on the user's settings)",
" * dev# - An audio device appeared or disappeared",
" * The callback will be called for each individual audio device event received from the OS, so you may receive multiple events for a single physical action (e.g. unplugging the default audio device will cause `dOut` and `dev#` events, and possibly `sOut` too)",
" * Passing nil will cause the watcher to stop if it is already running"
],
"parameters": [
" * fn - A callback function, or nil to remove a previously set callback. The callback function should accept a single argument (see Notes below)"
],
"returns": [
" * None"
],
"signature": "hs.audiodevice.watcher.setCallback(fn)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.watcher.start()",
"desc": "Starts the audio device watcher",
"doc": "Starts the audio device watcher\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "128",
"name": "start",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.audiodevice.watcher.start()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.audiodevice.watcher.stop() -> hs.audiodevice.watcher",
"desc": "Stops the audio device watcher",
"doc": "Stops the audio device watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.audiodevice.watcher` object",
"examples": [],
"file": "extensions/audiodevice/libaudiodevice_watcher.m",
"lineno": "166",
"name": "stop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.audiodevice.watcher` object"
],
"signature": "hs.audiodevice.watcher.stop() -> hs.audiodevice.watcher",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.audiodevice.watcher",
"stripped_doc": "",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [
{
"def": "hs.axuielement.actions[]",
"desc": "A table of common accessibility object action names, provided for reference.",
"doc": "A table of common accessibility object action names, provided for reference.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.actions`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "966",
"name": "actions",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.actions`"
],
"signature": "hs.axuielement.actions[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.attributes[]",
"desc": "A table of common accessibility object attribute names which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as keys in the match criteria argument.",
"doc": "A table of common accessibility object attribute names which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as keys in the match criteria argument.\n\nNotes:\n * This table is provided for reference only and is not intended to be comprehensive.\n * You can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.attributes`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "743",
"name": "attributes",
"notes": [
" * This table is provided for reference only and is not intended to be comprehensive.",
" * You can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.attributes`"
],
"signature": "hs.axuielement.attributes[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.orientations[]",
"desc": "A table of orientation types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXOrientation\" in the match criteria argument.",
"doc": "A table of orientation types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXOrientation\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.orientations`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1127",
"name": "orientations",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.orientations`"
],
"signature": "hs.axuielement.orientations[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.parameterizedAttributes[]",
"desc": "A table of common accessibility object parameterized attribute names, provided for reference.",
"doc": "A table of common accessibility object parameterized attribute names, provided for reference.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.parameterizedAttributes`\n * Parameterized attributes are attributes that take an argument when querying the element. There is very little documentation available for most of these and application developers can implement their own for which we may never be able to get any documentation. This table contains parameterized attribute names that are defined within the Apple documentation and a few others that have been discovered.\n * Documentation covering what has been discovered through experimentation about paramterized attributes is planned and should be added to the Hammerspoon wiki shortly after this module becomes part of a formal release.",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "926",
"name": "parameterizedAttributes",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.parameterizedAttributes`",
" * Parameterized attributes are attributes that take an argument when querying the element. There is very little documentation available for most of these and application developers can implement their own for which we may never be able to get any documentation. This table contains parameterized attribute names that are defined within the Apple documentation and a few others that have been discovered.",
" * Documentation covering what has been discovered through experimentation about paramterized attributes is planned and should be added to the Hammerspoon wiki shortly after this module becomes part of a formal release."
],
"signature": "hs.axuielement.parameterizedAttributes[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.roles[]",
"desc": "A table of common accessibility object roles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXRole\" in the match criteria argument.",
"doc": "A table of common accessibility object roles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXRole\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.roles`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "990",
"name": "roles",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.roles`"
],
"signature": "hs.axuielement.roles[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.rulerMarkers[]",
"desc": "A table of ruler marker types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXMarkerType\" in the match criteria argument.",
"doc": "A table of ruler marker types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXMarkerType\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.rulerMarkers`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1159",
"name": "rulerMarkers",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.rulerMarkers`"
],
"signature": "hs.axuielement.rulerMarkers[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.sortDirections[]",
"desc": "A table of sort direction types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSortDirection\" in the match criteria argument.",
"doc": "A table of sort direction types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSortDirection\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.sortDirections`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1143",
"name": "sortDirections",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.sortDirections`"
],
"signature": "hs.axuielement.sortDirections[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.subroles[]",
"desc": "A table of common accessibility object subroles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSubrole\" in the match criteria argument.",
"doc": "A table of common accessibility object subroles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSubrole\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.subroles`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1067",
"name": "subroles",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.subroles`"
],
"signature": "hs.axuielement.subroles[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.units[]",
"desc": "A table of measurement unit types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for attributes which specify measurement unit types (e.g. \"AXUnits\", \"AXHorizontalUnits\", and \"AXVerticalUnits\") in the match criteria argument.",
"doc": "A table of measurement unit types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for attributes which specify measurement unit types (e.g. \"AXUnits\", \"AXHorizontalUnits\", and \"AXVerticalUnits\") in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.units`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1180",
"name": "units",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.units`"
],
"signature": "hs.axuielement.units[]",
"stripped_doc": "",
"type": "Constant"
}
],
"Constructor": [
{
"def": "hs.axuielement.applicationElement(applicationObject) -> axuielementObject",
"desc": "Returns the top-level accessibility object for the application specified by the `hs.application` object.",
"doc": "Returns the top-level accessibility object for the application specified by the `hs.application` object.\n\nParameters:\n * `applicationObject` - the `hs.application` object for the Application or a string or number which will be passed to `hs.application.find` to get an `hs.application` object.\n\nReturns:\n * an axuielementObject for the application specified\n\nNotes:\n * if `applicationObject` is a string or number, only the first item found with `hs.application.find` will be used by this function to create an axuielementObject.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "98",
"name": "applicationElement",
"notes": [
" * if `applicationObject` is a string or number, only the first item found with `hs.application.find` will be used by this function to create an axuielementObject."
],
"parameters": [
" * `applicationObject` - the `hs.application` object for the Application or a string or number which will be passed to `hs.application.find` to get an `hs.application` object."
],
"returns": [
" * an axuielementObject for the application specified"
],
"signature": "hs.axuielement.applicationElement(applicationObject) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.applicationElementForPID(pid) -> axuielementObject",
"desc": "Returns the top-level accessibility object for the application with the specified process ID.",
"doc": "Returns the top-level accessibility object for the application with the specified process ID.\n\nParameters:\n * `pid` - the process ID of the application.\n\nReturns:\n * an axuielementObject for the application specified, or nil if it cannot be determined",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "144",
"name": "applicationElementForPID",
"notes": [],
"parameters": [
" * `pid` - the process ID of the application."
],
"returns": [
" * an axuielementObject for the application specified, or nil if it cannot be determined"
],
"signature": "hs.axuielement.applicationElementForPID(pid) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.systemElementAtPosition(x, y | pointTable) -> axuielementObject",
"desc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.",
"doc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.\n\nParameters:\n * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.\n * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.\n * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present.\n\nReturns:\n * an axuielementObject for the object at the specified coordinates, or nil if no object could be identified.\n\nNotes:\n * See also [hs.axuielement:elementAtPosition](#elementAtPosition) -- this function is a shortcut for `hs.axuielement.systemWideElement():elementAtPosition(...)`.\n * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "86",
"name": "systemElementAtPosition",
"notes": [
" * See also [hs.axuielement:elementAtPosition](#elementAtPosition) -- this function is a shortcut for `hs.axuielement.systemWideElement():elementAtPosition(...)`.",
" * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location."
],
"parameters": [
" * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.",
" * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.",
" * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present."
],
"returns": [
" * an axuielementObject for the object at the specified coordinates, or nil if no object could be identified."
],
"signature": "hs.axuielement.systemElementAtPosition(x, y | pointTable) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.systemWideElement() -> axuielementObject",
"desc": "Returns an accessibility object that provides access to system attributes.",
"doc": "Returns an accessibility object that provides access to system attributes.\n\nParameters:\n * None\n\nReturns:\n * the axuielementObject for the system attributes",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "126",
"name": "systemWideElement",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the axuielementObject for the system attributes"
],
"signature": "hs.axuielement.systemWideElement() -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.windowElement(windowObject) -> axuielementObject",
"desc": "Returns the accessibility object for the window specified by the `hs.window` object.",
"doc": "Returns the accessibility object for the window specified by the `hs.window` object.\n\nParameters:\n * `windowObject` - the `hs.window` object for the window or a string or number which will be passed to `hs.window.find` to get an `hs.window` object.\n\nReturns:\n * an axuielementObject for the window specified\n\nNotes:\n * if `windowObject` is a string or number, only the first item found with `hs.window.find` will be used by this function to create an axuielementObject.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "70",
"name": "windowElement",
"notes": [
" * if `windowObject` is a string or number, only the first item found with `hs.window.find` will be used by this function to create an axuielementObject."
],
"parameters": [
" * `windowObject` - the `hs.window` object for the window or a string or number which will be passed to `hs.window.find` to get an `hs.window` object."
],
"returns": [
" * an axuielementObject for the window specified"
],
"signature": "hs.axuielement.windowElement(windowObject) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.axuielement.searchCriteriaFunction(criteria) -> function",
"desc": "Returns a function for use with [hs.axuielement:elementSearch](#elementSearch) that uses [hs.axuielement:matchesCriteria](#matchesCriteria) with the specified criteria.",
"doc": "Returns a function for use with [hs.axuielement:elementSearch](#elementSearch) that uses [hs.axuielement:matchesCriteria](#matchesCriteria) with the specified criteria.\n\nParameters:\n * `criteria` - a criteria definition as defined for the [hs.axuielement:matchesCriteria](#matchesCriteria) method.\n\nReturns:\n * a function which can be used as the `criteriaFunction` for [hs.axuielement:elementSearch](#elementSearch).",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "464",
"name": "searchCriteriaFunction",
"notes": [],
"parameters": [
" * `criteria` - a criteria definition as defined for the [hs.axuielement:matchesCriteria](#matchesCriteria) method."
],
"returns": [
" * a function which can be used as the `criteriaFunction` for [hs.axuielement:elementSearch](#elementSearch)."
],
"signature": "hs.axuielement.searchCriteriaFunction(criteria) -> function",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [
{
"def": "hs.axuielement:actionDescription(action) -> string | nil, errString",
"desc": "Returns a localized description of the specified accessibility object's action.",
"doc": "Returns a localized description of the specified accessibility object's action.\n\nParameters:\n * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames).\n\nReturns:\n * a string containing a description of the object's action, nil if no description is available, or nil and an error string if an accessibility error occurred\n\nNotes:\n * The action descriptions are provided by the target application; as such their accuracy and usefulness rely on the target application's developers.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "254",
"name": "actionDescription",
"notes": [
" * The action descriptions are provided by the target application; as such their accuracy and usefulness rely on the target application's developers."
],
"parameters": [
" * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames)."
],
"returns": [
" * a string containing a description of the object's action, nil if no description is available, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:actionDescription(action) -> string | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:actionNames() -> table | nil, errString",
"desc": "Returns a list of all the actions the specified accessibility object can perform.",
"doc": "Returns a list of all the actions the specified accessibility object can perform.\n\nParameters:\n * None\n\nReturns:\n * an array of the names of all actions supported by the axuielementObject or nil and an error string if an accessibility error occurred\n\nNotes:\n * Common action names can be found in the [hs.axuielement.actions](#actions) table; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "221",
"name": "actionNames",
"notes": [
" * Common action names can be found in the [hs.axuielement.actions](#actions) table; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table."
],
"parameters": [
" * None"
],
"returns": [
" * an array of the names of all actions supported by the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:actionNames() -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:allAttributeValues([includeErrors]) -> table | nil, errString",
"desc": "Returns a table containing key-value pairs for all attributes of the accessibility object.",
"doc": "Returns a table containing key-value pairs for all attributes of the accessibility object.\n\nParameters:\n * `includeErrors` - an optional boolean, default false, that specifies whether attribute names which generate an error when retrieved are included in the returned results.\n\nReturns:\n * a table with key-value pairs corresponding to the attributes of the accessibility object or nil and an error string if an accessibility error occurred\n\nNotes:\n * if `includeErrors` is not specified or is false, then attributes which exist for the element, but currently have no value assigned, will not appear in the table. This is because Lua treats a nil value for a table's key-value pair as an instruction to remove the key from the table, if it currently exists.\n * To include attributes which exist but are currently unset, you need to specify `includeErrors` as true.\n * attributes for which no value is currently assigned will be given a table value with the following key-value pairs:\n * `_code` = -25212\n * `error` = \"Requested value does not exist\"",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "315",
"name": "allAttributeValues",
"notes": [
" * if `includeErrors` is not specified or is false, then attributes which exist for the element, but currently have no value assigned, will not appear in the table. This is because Lua treats a nil value for a table's key-value pair as an instruction to remove the key from the table, if it currently exists.",
" * To include attributes which exist but are currently unset, you need to specify `includeErrors` as true.",
" * attributes for which no value is currently assigned will be given a table value with the following key-value pairs:",
" * `_code` = -25212",
" * `error` = \"Requested value does not exist\""
],
"parameters": [
" * `includeErrors` - an optional boolean, default false, that specifies whether attribute names which generate an error when retrieved are included in the returned results."
],
"returns": [
" * a table with key-value pairs corresponding to the attributes of the accessibility object or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:allAttributeValues([includeErrors]) -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:allDescendantElements(callback, [withParents]) -> elementSearchObject",
"desc": "Query the accessibility object for all child accessibility objects and their descendants",
"doc": "Query the accessibility object for all child accessibility objects and their descendants\n\nParameters:\n * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the discovered descendant elements. `msg` will be \"completed\" when the traversal has completed normally and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)\n * `withParents` - an optional boolean, default false, indicating that the parent of objects (and their descendants) should be collected as well.\n\nReturns:\n * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)\n\nNotes:\n * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "502",
"name": "allDescendantElements",
"notes": [
" * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments."
],
"parameters": [
" * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the discovered descendant elements. `msg` will be \"completed\" when the traversal has completed normally and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)",
" * `withParents` - an optional boolean, default false, indicating that the parent of objects (and their descendants) should be collected as well."
],
"returns": [
" * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)"
],
"signature": "hs.axuielement:allDescendantElements(callback, [withParents]) -> elementSearchObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:asHSApplication() -> hs.application object | nil",
"desc": "If the element referes to an application, return an `hs.application` object for the element.",
"doc": "If the element referes to an application, return an `hs.application` object for the element.\n\nParameters:\n * None\n\nReturns:\n * if the element refers to an application, return an `hs.application` object for the element ; otherwise return nil\n\nNotes:\n * An element is considered an application by this method if it has an AXRole of AXApplication and has a process identifier (pid).",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "645",
"name": "asHSApplication",
"notes": [
" * An element is considered an application by this method if it has an AXRole of AXApplication and has a process identifier (pid)."
],
"parameters": [
" * None"
],
"returns": [
" * if the element refers to an application, return an `hs.application` object for the element ; otherwise return nil"
],
"signature": "hs.axuielement:asHSApplication() -> hs.application object | nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:asHSWindow() -> hs.window object | nil",
"desc": "If the element referes to a window, return an `hs.window` object for the element.",
"doc": "If the element referes to a window, return an `hs.window` object for the element.\n\nParameters:\n * None\n\nReturns:\n * if the element refers to a window, return an `hs.window` object for the element ; otherwise return nil\n\nNotes:\n * An element is considered a window by this method if it has an AXRole of AXWindow.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "680",
"name": "asHSWindow",
"notes": [
" * An element is considered a window by this method if it has an AXRole of AXWindow."
],
"parameters": [
" * None"
],
"returns": [
" * if the element refers to a window, return an `hs.window` object for the element ; otherwise return nil"
],
"signature": "hs.axuielement:asHSWindow() -> hs.window object | nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:attributeNames() -> table | nil, errString",
"desc": "Returns a list of all the attributes supported by the specified accessibility object.",
"doc": "Returns a list of all the attributes supported by the specified accessibility object.\n\nParameters:\n * None\n\nReturns:\n * an array of the names of all attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred\n\nNotes:\n * Common attribute names can be found in the [hs.axuielement.attributes](#attributes) tables; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "188",
"name": "attributeNames",
"notes": [
" * Common attribute names can be found in the [hs.axuielement.attributes](#attributes) tables; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table."
],
"parameters": [
" * None"
],
"returns": [
" * an array of the names of all attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:attributeNames() -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:attributeValue(attribute) -> value | nil, errString",
"desc": "Returns the value of an accessibility object's attribute.",
"doc": "Returns the value of an accessibility object's attribute.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n\nReturns:\n * the current value of the attribute, nil if the attribute has no value, or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "286",
"name": "attributeValue",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames)."
],
"returns": [
" * the current value of the attribute, nil if the attribute has no value, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:attributeValue(attribute) -> value | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:attributeValueCount(attribute) -> integer | nil, errString",
"desc": "Returns the count of the array of an accessibility object's attribute value.",
"doc": "Returns the count of the array of an accessibility object's attribute value.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n\nReturns:\n * the number of items in the value for the attribute, if it is an array, or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "365",
"name": "attributeValueCount",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames)."
],
"returns": [
" * the number of items in the value for the attribute, if it is an array, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:attributeValueCount(attribute) -> integer | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:buildTree(callback, [depth], [withParents]) -> elementSearchObject",
"desc": "Captures all of the available information for the accessibility object and its descendants and returns it in a table for inspection.",
"doc": "Captures all of the available information for the accessibility object and its descendants and returns it in a table for inspection.\n\nParameters:\n * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the recorded information. `msg` will be \"completed\" when the search has completed normally (or reached the specified depth) and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)\n * `depth` - an optional integer, default `math.huge`, specifying the maximum depth from the initial accessibility object that should be visited to identify descendant elements and their attributes.\n * `withParents` - an optional boolean, default false, specifying whether or not an element's (or descendant's) attributes for `AXParent` and `AXTopLevelUIElement` should also be visited when identifying additional elements to include in the results table.\n\nReturns:\n * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)\n\nNotes:\n* The format of the `results` table passed to the callback for this method is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.\n * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "478",
"name": "buildTree",
"notes": [
"* The format of the `results` table passed to the callback for this method is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.",
" * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments."
],
"parameters": [
" * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the recorded information. `msg` will be \"completed\" when the search has completed normally (or reached the specified depth) and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)",
" * `depth` - an optional integer, default `math.huge`, specifying the maximum depth from the initial accessibility object that should be visited to identify descendant elements and their attributes.",
" * `withParents` - an optional boolean, default false, specifying whether or not an element's (or descendant's) attributes for `AXParent` and `AXTopLevelUIElement` should also be visited when identifying additional elements to include in the results table."
],
"returns": [
" * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)"
],
"signature": "hs.axuielement:buildTree(callback, [depth], [withParents]) -> elementSearchObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:childrenWithRole(role) -> table",
"desc": "Returns a table containing only those immediate children of the element that perform the specified role.",
"doc": "Returns a table containing only those immediate children of the element that perform the specified role.\n\nParameters:\n * `role` - a string specifying the role that the returned children must perform. Example values can be found in [hs.axuielement.roles](#roles).\n\nReturns:\n * a table containing zero or more axuielementObjects.\n\nNotes:\n * only the immediate children of the object are searched.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "972",
"name": "childrenWithRole",
"notes": [
" * only the immediate children of the object are searched."
],
"parameters": [
" * `role` - a string specifying the role that the returned children must perform. Example values can be found in [hs.axuielement.roles](#roles)."
],
"returns": [
" * a table containing zero or more axuielementObjects."
],
"signature": "hs.axuielement:childrenWithRole(role) -> table",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:copy() -> axuielementObject",
"desc": "Return a duplicate userdata reference to the Accessibility object.",
"doc": "Return a duplicate userdata reference to the Accessibility object.\n\nParameters:\n * None\n\nReturns:\n * a new userdata object representing a new reference to the Accessibility object.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "171",
"name": "copy",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a new userdata object representing a new reference to the Accessibility object."
],
"signature": "hs.axuielement:copy() -> axuielementObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:elementAtPosition(x, y | pointTable) -> axuielementObject | nil, errString",
"desc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.",
"doc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.\n\nParameters:\n * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.\n * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.\n * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present.\n\nReturns:\n * an axuielementObject for the object at the specified coordinates, or nil and an error string if no object could be identified or an accessibility error occurred\n\nNotes:\n * This method can only be called on an axuielementObject that represents an application or the system-wide element (see [hs.axuielement.systemWideElement](#systemWideElement)).\n * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location.\n * If this method is called on an axuielementObject representing an application, the search is restricted to the application.\n * If this method is called on an axuielementObject representing the system-wide element, the search is not restricted to any particular application. See [hs.axuielement.systemElementAtPosition](#systemElementAtPosition).",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "533",
"name": "elementAtPosition",
"notes": [
" * This method can only be called on an axuielementObject that represents an application or the system-wide element (see [hs.axuielement.systemWideElement](#systemWideElement)).",
" * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location.",
" * If this method is called on an axuielementObject representing an application, the search is restricted to the application.",
" * If this method is called on an axuielementObject representing the system-wide element, the search is not restricted to any particular application. See [hs.axuielement.systemElementAtPosition](#systemElementAtPosition)."
],
"parameters": [
" * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.",
" * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.",
" * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present."
],
"returns": [
" * an axuielementObject for the object at the specified coordinates, or nil and an error string if no object could be identified or an accessibility error occurred"
],
"signature": "hs.axuielement:elementAtPosition(x, y | pointTable) -> axuielementObject | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:elementSearch(callback, [criteria], [namedModifiers]) -> elementSearchObject",
"desc": "Search for and generate a table of the accessibility elements for the attributes and descendants of this object based on the specified criteria.",
"doc": "Search for and generate a table of the accessibility elements for the attributes and descendants of this object based on the specified criteria.\n\nParameters:\n * `callback` - a (usually) required function which will receive the results of this search. The callback should expect three arguments and return none. The arguments to the callback function will be `msg`, a string specifying how the search ended and `results`, the elementSearchObject containing the requested results, and the number of items added to the results (see `count` in `namedModifiers`). `msg` will be \"completed\" if the search completes normally, or a string starting with \"**\" if it is terminated early (see Returns: and Notes: for more details).\n * `criteria` - an optional function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.\n * `namedModifiers` - an optional table specifying key-value pairs that further modify or control the search. This table may contain 0 or more of the following keys:\n * `count` - an optional integer, default `math.huge`, specifying the maximum number of matches to collect before ending the search and invoking the callback. You can continue the search to find additional elements by invoking `elementSearchObject:next()` (described below in the `Returns` section) on the return value of this method, or on the results argument passed to the callback.\n * `depth` - an optional integer, default `math.huge`, specifying the maximum number of steps (descendants) from the initial accessibility element the search should visit. If you know that your desired element(s) are relatively close to your starting element, setting this to a lower value can significantly speed up the search.\n * The following are also recognized, but may impact the speed of the search, the responsiveness of Hammerspoon, or the format of the results in ways that limit further filtering and are not recommended except when you know that you require them:\n * `asTree` - an optional boolean, default false, and ignored if `criteria` is specified and non-empty, `objectOnly` is true, or `count` is specified. This modifier specifies whether the search results should return as an array table of tables containing each element's details (false) or as a tree where in which the root node details are the key-value pairs of the returned table and descendant elements are likewise described in subtables attached to the attribute name they belong to (true). This format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.\n * `includeParents` - a boolean, default false, specifying whether or not parent attributes (`AXParent` and `AXTopLevelUIElement`) should be examined during the search. Note that in most cases, setting this value to true will end up traversing the entire Accessibility structure for the target application and may significantly slow down the search.\n * `noCallback` - an optional boolean, default false, and ignored if `callback` is not also nil, allowing you to specify nil as the callback when set to true. This feature requires setting this named argumennt to true *and* specifying the callback field as nil because starting a query from an element with a lot of descendants **WILL** block Hammerspoon and slow down the responsiveness of your computer (I've seen blocking for over 5 minutes in extreme cases) and should be used *only* when you know you are starting from close to the end of the element heirarchy.\n * `objectOnly` - an optional boolean, default true, specifying whether each result in the final table will be the accessibility element discovered (true) or a table containing details about the element include the attribute names, actions, etc. for the element (false). This latter format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.\n\nReturns:\n * an elementSearchObject which contains metamethods allowing you to check to see if the process has completed and cancel it early if desired. The methods include:\n * `elementSearchObject:cancel([reason])` - cancels the current search and invokes the callback with the partial results already collected. If you specify `reason`, the `msg` argument for the callback will be `** <reason>`; otherwise it will be \"** cancelled\".\n * `elementSearchObject:isRunning()` - returns true if the search is currently ongoing or false if it has completed or been cancelled.\n * `elementSearchObject:matched()` - returns an integer specifying the number of elements which have already been found that meet the specified criteria function.\n * `elementSearchObject:runTime()` - returns an integer specifying the number of seconds spent performing this search. Note that this is *not* an accurate measure of how much time a given search will always take because the time will be greatly affected by how much other activity is occurring within Hammerspoon and on the users computer. Resuming a cancelled search or a search which invoked the callback because it reached `count` items with the `next` method (descibed below) will cause this number to begin increasing again to provide a cumulative total of time spent performing the search; time between when the callback is invoked and the `next` method is invoked is not included.\n * `elementSearchObject:visited()` - returns an integer specifying the number of elements which have been examined during the search so far.\n * If `asTree` is false or not specified, the following additional methods will be available:\n * `elementSearchObject:filter(criteria, [callback]) -> filterObject`\n * returns a new table containing elements in the search results that match the specified criteria.\n * `criteria` - a required function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.\n * `callback` - an optional callback which should expect two arguments and return none. If a callback is specified, the callback will receive two arguments, a msg indicating how the callback ended (the message format matches the style defined for this method) and the filterObject which contains the matching elements.\n * The filterObject returned by this method and passed to the callback, if defined, will support the following methods as defined here: `cancel`, `filter`, `isRunning`, `matched`, `runTime`, and `visited`.\n * `elementSearchObject:next()` - if the search was cancelled or reached the count of matches specified, this method will continue the search where it left off. The elementSearchObject returned when the callback is next invoked will have up to `count` items added to the existing results (calls to `next` are cummulative for the total results captured in the elementSearchObject). The third ardument to the callback will be the number of items *added* to the search results, not the number of items *in* the search results.\n\nNotes:\n * This method utilizes coroutines to keep Hammerspoon responsive, but may be slow to complete if `includeParents` is true, if you do not specify `depth`, or if you start from an element that has a lot of descendants (e.g. the application element for a web browser). This is dependent entirely upon how many active accessibility elements the target application defines and where you begin your search and cannot reliably be determined up front, so you may need to experiment to find the best balance for your specific requirements.\n * The search performed is a breadth-first search, so in general earlier elements in the results table will be \"closer\" in the Accessibility hierarchy to the starting point than later elements.\n * The `elementSearchObject` returned by this method and the results passed in as the second argument to the callback function are the same object -- you can use either one in your code depending upon which makes the most sense. Results that match the criteria function are added to the `elementSearchObject` as they are found, so if you examine the object/table returned by this method and determine that you have located the element or elements you require before the callback has been invoked, you can safely invoke the cancel method to end the search early.\n * The exception to this is when `asTree` is true and `objectsOnly` is false and the search criteria is nil -- see [hs.axuielement:buildTree](#buildTree). In this case, the results passed to the callback will be equal to `elementSearchObject[1]`.\n * If `objectsOnly` is specified as false, it may take some time after `cancel` is invoked for the mapping of element attribute tables to the descendant elements in the results set -- this is a by product of the need to iterate through the results to match up all of the instances of each element to it's attribute table.\n * [hs.axuielement:allDescendantElements](#allDescendantElements) is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`\n * [hs.axuielement:buildTree](#buildTree) is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "766",
"name": "elementSearch",
"notes": [
" * This method utilizes coroutines to keep Hammerspoon responsive, but may be slow to complete if `includeParents` is true, if you do not specify `depth`, or if you start from an element that has a lot of descendants (e.g. the application element for a web browser). This is dependent entirely upon how many active accessibility elements the target application defines and where you begin your search and cannot reliably be determined up front, so you may need to experiment to find the best balance for your specific requirements.",
" * The search performed is a breadth-first search, so in general earlier elements in the results table will be \"closer\" in the Accessibility hierarchy to the starting point than later elements.",
" * The `elementSearchObject` returned by this method and the results passed in as the second argument to the callback function are the same object -- you can use either one in your code depending upon which makes the most sense. Results that match the criteria function are added to the `elementSearchObject` as they are found, so if you examine the object/table returned by this method and determine that you have located the element or elements you require before the callback has been invoked, you can safely invoke the cancel method to end the search early.",
" * The exception to this is when `asTree` is true and `objectsOnly` is false and the search criteria is nil -- see [hs.axuielement:buildTree](#buildTree). In this case, the results passed to the callback will be equal to `elementSearchObject[1]`.",
" * If `objectsOnly` is specified as false, it may take some time after `cancel` is invoked for the mapping of element attribute tables to the descendant elements in the results set -- this is a by product of the need to iterate through the results to match up all of the instances of each element to it's attribute table.",
" * [hs.axuielement:allDescendantElements](#allDescendantElements) is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`",
" * [hs.axuielement:buildTree](#buildTree) is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`"
],
"parameters": [
" * `callback` - a (usually) required function which will receive the results of this search. The callback should expect three arguments and return none. The arguments to the callback function will be `msg`, a string specifying how the search ended and `results`, the elementSearchObject containing the requested results, and the number of items added to the results (see `count` in `namedModifiers`). `msg` will be \"completed\" if the search completes normally, or a string starting with \"**\" if it is terminated early (see Returns: and Notes: for more details).",
" * `criteria` - an optional function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.",
" * `namedModifiers` - an optional table specifying key-value pairs that further modify or control the search. This table may contain 0 or more of the following keys:\n * `count` - an optional integer, default `math.huge`, specifying the maximum number of matches to collect before ending the search and invoking the callback. You can continue the search to find additional elements by invoking `elementSearchObject:next()` (described below in the `Returns` section) on the return value of this method, or on the results argument passed to the callback.\n * `depth` - an optional integer, default `math.huge`, specifying the maximum number of steps (descendants) from the initial accessibility element the search should visit. If you know that your desired element(s) are relatively close to your starting element, setting this to a lower value can significantly speed up the search.\n * The following are also recognized, but may impact the speed of the search, the responsiveness of Hammerspoon, or the format of the results in ways that limit further filtering and are not recommended except when you know that you require them: * `asTree` - an optional boolean, default false, and ignored if `criteria` is specified and non-empty, `objectOnly` is true, or `count` is specified. This modifier specifies whether the search results should return as an array table of tables containing each element's details (false) or as a tree where in which the root node details are the key-value pairs of the returned table and descendant elements are likewise described in subtables attached to the attribute name they belong to (true). This format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation. * `includeParents` - a boolean, default false, specifying whether or not parent attributes (`AXParent` and `AXTopLevelUIElement`) should be examined during the search. Note that in most cases, setting this value to true will end up traversing the entire Accessibility structure for the target application and may significantly slow down the search. * `noCallback` - an optional boolean, default false, and ignored if `callback` is not also nil, allowing you to specify nil as the callback when set to true. This feature requires setting this named argumennt to true *and* specifying the callback field as nil because starting a query from an element with a lot of descendants **WILL** block Hammerspoon and slow down the responsiveness of your computer (I've seen blocking for over 5 minutes in extreme cases) and should be used *only* when you know you are starting from close to the end of the element heirarchy. * `objectOnly` - an optional boolean, default true, specifying whether each result in the final table will be the accessibility element discovered (true) or a table containing details about the element include the attribute names, actions, etc. for the element (false). This latter format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation."
],
"returns": [
" * an elementSearchObject which contains metamethods allowing you to check to see if the process has completed and cancel it early if desired. The methods include:",
" * `elementSearchObject:cancel([reason])` - cancels the current search and invokes the callback with the partial results already collected. If you specify `reason`, the `msg` argument for the callback will be `** <reason>`; otherwise it will be \"** cancelled\".",
" * `elementSearchObject:isRunning()` - returns true if the search is currently ongoing or false if it has completed or been cancelled.",
" * `elementSearchObject:matched()` - returns an integer specifying the number of elements which have already been found that meet the specified criteria function.",
" * `elementSearchObject:runTime()` - returns an integer specifying the number of seconds spent performing this search. Note that this is *not* an accurate measure of how much time a given search will always take because the time will be greatly affected by how much other activity is occurring within Hammerspoon and on the users computer. Resuming a cancelled search or a search which invoked the callback because it reached `count` items with the `next` method (descibed below) will cause this number to begin increasing again to provide a cumulative total of time spent performing the search; time between when the callback is invoked and the `next` method is invoked is not included.",
" * `elementSearchObject:visited()` - returns an integer specifying the number of elements which have been examined during the search so far.",
" * If `asTree` is false or not specified, the following additional methods will be available:",
" * `elementSearchObject:filter(criteria, [callback]) -> filterObject`",
" * returns a new table containing elements in the search results that match the specified criteria.",
" * `criteria` - a required function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.",
" * `callback` - an optional callback which should expect two arguments and return none. If a callback is specified, the callback will receive two arguments, a msg indicating how the callback ended (the message format matches the style defined for this method) and the filterObject which contains the matching elements.",
" * The filterObject returned by this method and passed to the callback, if defined, will support the following methods as defined here: `cancel`, `filter`, `isRunning`, `matched`, `runTime`, and `visited`.",
" * `elementSearchObject:next()` - if the search was cancelled or reached the count of matches specified, this method will continue the search where it left off. The elementSearchObject returned when the callback is next invoked will have up to `count` items added to the existing results (calls to `next` are cummulative for the total results captured in the elementSearchObject). The third ardument to the callback will be the number of items *added* to the search results, not the number of items *in* the search results."
],
"signature": "hs.axuielement:elementSearch(callback, [criteria], [namedModifiers]) -> elementSearchObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:isAttributeSettable(attribute) -> boolean | nil, errString",
"desc": "Returns whether the specified accessibility object's attribute can be modified.",
"doc": "Returns whether the specified accessibility object's attribute can be modified.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n\nReturns:\n * a boolean value indicating whether or not the value of the parameter can be modified or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "421",
"name": "isAttributeSettable",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames)."
],
"returns": [
" * a boolean value indicating whether or not the value of the parameter can be modified or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:isAttributeSettable(attribute) -> boolean | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:isValid() -> boolean | nil, errString",
"desc": "Returns whether the specified accessibility object is still valid.",
"doc": "Returns whether the specified accessibility object is still valid.\n\nParameters:\n * None\n\nReturns:\n * a boolean value indicating whether or not the accessibility object is still valid or nil and an error string if any other accessibility error occurred\n\nNotes:\n * an accessibilityObject can become invalid for a variety of reasons, including but not limited to the element referred to no longer being available (e.g. an element referring to a window or one of its descendants that has been closed) or the application terminating.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "447",
"name": "isValid",
"notes": [
" * an accessibilityObject can become invalid for a variety of reasons, including but not limited to the element referred to no longer being available (e.g. an element referring to a window or one of its descendants that has been closed) or the application terminating."
],
"parameters": [
" * None"
],
"returns": [
" * a boolean value indicating whether or not the accessibility object is still valid or nil and an error string if any other accessibility error occurred"
],
"signature": "hs.axuielement:isValid() -> boolean | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:matchesCriteria(criteria) -> boolean",
"desc": "Returns true if the axuielementObject matches the specified criteria or false if it does not.",
"doc": "Returns true if the axuielementObject matches the specified criteria or false if it does not.\n\nParameters:\n * `criteria` - the criteria to compare against the accessibility object\n\nReturns:\n * true if the axuielementObject matches the criteria, false if it does not.\n\nNotes:\n * the `criteria` argument must be one of the following:\n * a single string, specifying the value the element's AXRole attribute must equal for a positive match\n * an array table of strings specifying a list of possible values the element's AXRole attribute can equal for a positive match\n * a table of key-value pairs specifying a more complex criteria. The table should be defined as follows:\n * one or more of the following must be specified (though all specified must match):\n * `attribute` -- a string, or table of strings, specifying attributes that the element must support.\n * `action` -- a string, or table of strings, specifying actions that the element must be able to perform.\n * `parameterizedAttribute` -- a string, or table of strings, specifying parametrized attributes that the element must support.\n * if the `attribute` key is specified, you can use one of the the following to specify a specific value the attribute must equal for a positive match. No more than one of these should be provided. If neither are present, then only the existence of the attributes specified by `attribute` are required.\n * `value` -- a value, or table of values, that a specifeid attribute must equal. If it's a table, then only one of the values has to match the attribute value for a positive match. Note that if you specify more than one attribute with the `attribute` key, you must provide at least one value for each attribute in this table (order does not matter, but the match will fail if any atrribute does not match at least one value provided).\n * when specifying a value which is itself a table with keys (e.g. frame, size, url, color, etc.) then you *must* provide the value or values as a table of tables, e.g. `{ { y = 22 } }`.\n * only those keys which are specified within the value are checked for equality (or pattern matching). Values which are present in the attribute's value but are not specified in the comparioson value are ignored (i.e. the previous example of `y = 22` would only check the `y` component of an AXFrame attribute -- the `x`, `h`, and `w` values would be ignored).\n * For value compoents which are numeric, e.g. `22` in the previous example, the default comparison is equality. You may change this with the `comparison` key described below in the optional keys.\n * For possible keys when trying to match a color, see the documentation for `hs.drawing.color`.\n * For possible keys when trying to match a URL, use `url = <string>` and/or `filePath = <string>`. The string for the specified table key will be compared in accordance with the `pattern` optional key described below.\n * when specifying a value which is itself a table of values (e.g. a list of axuielementObjects) you *must* provide the value or values as a table of tables, e.g. `{ { obj1, obj2 } }`.\n * Order of the elements provided in the comparison value does not matter -- this only tests for existence within the attributes value.\n * The test is for inclusion only -- the attribute's value may contain other elements as well, but must contain those specified within the comparison value.\n * `nilValue` -- a boolean, specifying that the attributes must not have an assigned value (true) or may be assigned any value except nil (false). If the `value` key is specified, this key is ignored. Note that this applies to *all* of the attributes specified with the `attribute` key.\n * the following are optional keys and are not required:\n * `pattern` -- a boolean, default false, specifying whether string matches for attribute values should be evaluated with `string.match` (true) or as exact matches (false). See the Lua manual, section 6.4.1 (`help.lua._man._6_4_1` in the Hammerspoon console). If the `value` key is not set, than this key is ignored.\n * `invert` -- a boolean, default false, specifying inverted logic for the criteria result --- if this is true and the criteria matches, evaluate criteria as false; otherwise evaluate as true.\n * `comparison` -- a string, default \"==\", specifying the comparison to be used when comparing numeric values. Possible comparison strings are: \"==\" for equality, \"<\" for less than, \"<=\" for less than or equal to, \">\" for greater than, \">=\" for greater than or equal to, or \"~=\" for not equal to.\n\n * an array table of one or more key-value tables as described immediately above; the element must be a positive match for all of the individual criteria tables specified (logical AND).\n * This method is used by [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create criteria functions compatible with [hs.axuielement:elementSearch](#elementSearch).",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "265",
"name": "matchesCriteria",
"notes": [
" * the `criteria` argument must be one of the following:",
" * a single string, specifying the value the element's AXRole attribute must equal for a positive match",
" * an array table of strings specifying a list of possible values the element's AXRole attribute can equal for a positive match",
" * a table of key-value pairs specifying a more complex criteria. The table should be defined as follows:",
" * one or more of the following must be specified (though all specified must match):",
" * `attribute` -- a string, or table of strings, specifying attributes that the element must support.",
" * `action` -- a string, or table of strings, specifying actions that the element must be able to perform.",
" * `parameterizedAttribute` -- a string, or table of strings, specifying parametrized attributes that the element must support.",
" * if the `attribute` key is specified, you can use one of the the following to specify a specific value the attribute must equal for a positive match. No more than one of these should be provided. If neither are present, then only the existence of the attributes specified by `attribute` are required.",
" * `value` -- a value, or table of values, that a specifeid attribute must equal. If it's a table, then only one of the values has to match the attribute value for a positive match. Note that if you specify more than one attribute with the `attribute` key, you must provide at least one value for each attribute in this table (order does not matter, but the match will fail if any atrribute does not match at least one value provided).",
" * when specifying a value which is itself a table with keys (e.g. frame, size, url, color, etc.) then you *must* provide the value or values as a table of tables, e.g. `{ { y = 22 } }`.",
" * only those keys which are specified within the value are checked for equality (or pattern matching). Values which are present in the attribute's value but are not specified in the comparioson value are ignored (i.e. the previous example of `y = 22` would only check the `y` component of an AXFrame attribute -- the `x`, `h`, and `w` values would be ignored).",
" * For value compoents which are numeric, e.g. `22` in the previous example, the default comparison is equality. You may change this with the `comparison` key described below in the optional keys.",
" * For possible keys when trying to match a color, see the documentation for `hs.drawing.color`.",
" * For possible keys when trying to match a URL, use `url = <string>` and/or `filePath = <string>`. The string for the specified table key will be compared in accordance with the `pattern` optional key described below.",
" * when specifying a value which is itself a table of values (e.g. a list of axuielementObjects) you *must* provide the value or values as a table of tables, e.g. `{ { obj1, obj2 } }`.",
" * Order of the elements provided in the comparison value does not matter -- this only tests for existence within the attributes value.",
" * The test is for inclusion only -- the attribute's value may contain other elements as well, but must contain those specified within the comparison value.",
" * `nilValue` -- a boolean, specifying that the attributes must not have an assigned value (true) or may be assigned any value except nil (false). If the `value` key is specified, this key is ignored. Note that this applies to *all* of the attributes specified with the `attribute` key.",
" * the following are optional keys and are not required:",
" * `pattern` -- a boolean, default false, specifying whether string matches for attribute values should be evaluated with `string.match` (true) or as exact matches (false). See the Lua manual, section 6.4.1 (`help.lua._man._6_4_1` in the Hammerspoon console). If the `value` key is not set, than this key is ignored.",
" * `invert` -- a boolean, default false, specifying inverted logic for the criteria result --- if this is true and the criteria matches, evaluate criteria as false; otherwise evaluate as true.",
" * `comparison` -- a string, default \"==\", specifying the comparison to be used when comparing numeric values. Possible comparison strings are: \"==\" for equality, \"<\" for less than, \"<=\" for less than or equal to, \">\" for greater than, \">=\" for greater than or equal to, or \"~=\" for not equal to.",
"",
" * an array table of one or more key-value tables as described immediately above; the element must be a positive match for all of the individual criteria tables specified (logical AND).",
" * This method is used by [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create criteria functions compatible with [hs.axuielement:elementSearch](#elementSearch)."
],
"parameters": [
" * `criteria` - the criteria to compare against the accessibility object"
],
"returns": [
" * true if the axuielementObject matches the criteria, false if it does not."
],
"signature": "hs.axuielement:matchesCriteria(criteria) -> boolean",
"stripped_doc": " * an array table of one or more key-value tables as described immediately above; the element must be a positive match for all of the individual criteria tables specified (logical AND).\n * This method is used by [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create criteria functions compatible with [hs.axuielement:elementSearch](#elementSearch).",
"type": "Method"
},
{
"def": "hs.axuielement:parameterizedAttributeNames() -> table | nil, errString",
"desc": "Returns a list of all the parameterized attributes supported by the specified accessibility object.",
"doc": "Returns a list of all the parameterized attributes supported by the specified accessibility object.\n\nParameters:\n * None\n\nReturns:\n * an array of the names of all parameterized attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "391",
"name": "parameterizedAttributeNames",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * an array of the names of all parameterized attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:parameterizedAttributeNames() -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:parameterizedAttributeValue(attribute, parameter) -> value | nil, errString",
"desc": "Returns the value of an accessibility object's parameterized attribute.",
"doc": "Returns the value of an accessibility object's parameterized attribute.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:parameterizedAttributeNames](#parameterizedAttributeNames).\n * `parameter` - the parameter required by the paramaterized attribute.\n\nReturns:\n * the current value of the parameterized attribute, nil if the parameterized attribute has no value, or nil and an error string if an accessibility error occurred\n\nNotes:\n * The specific parameter required for a each parameterized attribute is different and is often application specific thus requiring some experimentation. Notes regarding identified parameter types and thoughts on some still being investigated will be provided in the Hammerspoon Wiki, hopefully shortly after this module becomes part of a Hammerspoon release.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "582",
"name": "parameterizedAttributeValue",
"notes": [
" * The specific parameter required for a each parameterized attribute is different and is often application specific thus requiring some experimentation. Notes regarding identified parameter types and thoughts on some still being investigated will be provided in the Hammerspoon Wiki, hopefully shortly after this module becomes part of a Hammerspoon release."
],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:parameterizedAttributeNames](#parameterizedAttributeNames).",
" * `parameter` - the parameter required by the paramaterized attribute."
],
"returns": [
" * the current value of the parameterized attribute, nil if the parameterized attribute has no value, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:parameterizedAttributeValue(attribute, parameter) -> value | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:path() -> table",
"desc": "Returns a table of axuielements tracing this object through its parent objects to the root for this element, most likely an application object or the system wide object.",
"doc": "Returns a table of axuielements tracing this object through its parent objects to the root for this element, most likely an application object or the system wide object.\n\nParameters:\n * None\n\nReturns:\n * a table containing this object and 0 or more parent objects representing the path from the root object to this element.\n\nNotes:\n * this object will always exist as the last element in the table (e.g. at `table[#table]`) with its most immediate parent at `#table - 1`, etc. until the rootmost object for this element is reached at index position 1.\n * an axuielement object representing an application or the system wide object is its own rootmost object and will return a table containing only itself (i.e. `#table` will equal 1)",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "211",
"name": "path",
"notes": [
" * this object will always exist as the last element in the table (e.g. at `table[#table]`) with its most immediate parent at `#table - 1`, etc. until the rootmost object for this element is reached at index position 1.",
" * an axuielement object representing an application or the system wide object is its own rootmost object and will return a table containing only itself (i.e. `#table` will equal 1)"
],
"parameters": [
" * None"
],
"returns": [
" * a table containing this object and 0 or more parent objects representing the path from the root object to this element."
],
"signature": "hs.axuielement:path() -> table",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:performAction(action) -> axuielement | false | nil, errString",
"desc": "Requests that the specified accessibility object perform the specified action.",
"doc": "Requests that the specified accessibility object perform the specified action.\n\nParameters:\n * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames).\n\nReturns:\n * if the requested action was accepted by the target, returns the axuielementObject; if the requested action was rejected, returns false; otherwise returns nil and an error string if an accessibility error occurred\n\nNotes:\n * The return value only suggests success or failure, but is not a guarantee. The receiving application may have internal logic which prevents the action from occurring at this time for some reason, even though this method returns success (the axuielementObject). Contrawise, the requested action may trigger a requirement for a response from the user and thus appear to time out, causing this method to return false or nil.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "503",
"name": "performAction",
"notes": [
" * The return value only suggests success or failure, but is not a guarantee. The receiving application may have internal logic which prevents the action from occurring at this time for some reason, even though this method returns success (the axuielementObject). Contrawise, the requested action may trigger a requirement for a response from the user and thus appear to time out, causing this method to return false or nil."
],
"parameters": [
" * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames)."
],
"returns": [
" * if the requested action was accepted by the target, returns the axuielementObject; if the requested action was rejected, returns false; otherwise returns nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:performAction(action) -> axuielement | false | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:pid() -> integer | nil, errString",
"desc": "Returns the process ID associated with the specified accessibility object.",
"doc": "Returns the process ID associated with the specified accessibility object.\n\nParameters:\n * None\n\nReturns:\n * the process ID for the application to which the accessibility object ultimately belongs or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "478",
"name": "pid",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the process ID for the application to which the accessibility object ultimately belongs or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:pid() -> integer | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:setAttributeValue(attribute, value) -> axuielementObject | nil, errString",
"desc": "Sets the accessibility object's attribute to the specified value.",
"doc": "Sets the accessibility object's attribute to the specified value.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n * `value` - the value to assign to the attribute\n\nReturns:\n * the axuielementObject on success; nil and an error string if the attribute could not be set or an accessibility error occurred.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "617",
"name": "setAttributeValue",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).",
" * `value` - the value to assign to the attribute"
],
"returns": [
" * the axuielementObject on success; nil and an error string if the attribute could not be set or an accessibility error occurred."
],
"signature": "hs.axuielement:setAttributeValue(attribute, value) -> axuielementObject | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:setTimeout(value) -> axuielementObject | nil, errString",
"desc": "Sets the timeout value used accessibility queries performed from this element.",
"doc": "Sets the timeout value used accessibility queries performed from this element.\n\nParameters:\n * `value` - the number of seconds for the new timeout value. Must be 0 or positive.\n\nReturns:\n * the axuielementObject or nil and an error string if an accessibility error occurred\n\nNotes:\n * To change the global timeout affecting all queries on elements which do not have a specific timeout set, use this method on the systemwide element (see [hs.axuielement.systemWideElement](#systemWideElement).\n * Changing the timeout value for an axuielement object only changes the value for that specific element -- other axuieleement objects that may refer to the identical accessibiity item are not affected.\n * Setting the value to 0.0 resets the timeout -- if applied to the `systemWideElement`, the global default will be reset to its default value; if applied to another axuielement object, the timeout will be reset to the current global value as applied to the systemWideElement.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "710",
"name": "setTimeout",
"notes": [
" * To change the global timeout affecting all queries on elements which do not have a specific timeout set, use this method on the systemwide element (see [hs.axuielement.systemWideElement](#systemWideElement).",
" * Changing the timeout value for an axuielement object only changes the value for that specific element -- other axuieleement objects that may refer to the identical accessibiity item are not affected.",
" * Setting the value to 0.0 resets the timeout -- if applied to the `systemWideElement`, the global default will be reset to its default value; if applied to another axuielement object, the timeout will be reset to the current global value as applied to the systemWideElement."
],
"parameters": [
" * `value` - the number of seconds for the new timeout value. Must be 0 or positive."
],
"returns": [
" * the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:setTimeout(value) -> axuielementObject | nil, errString",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "This module allows you to access the accessibility objects of running applications, their windows, menus, and other user interface elements that support the OS X accessibility API.",
"doc": "This module allows you to access the accessibility objects of running applications, their windows, menus, and other user interface elements that support the OS X accessibility API.\n\nThis module works through the use of axuielementObjects, which is the Hammerspoon representation for an accessibility object. An accessibility object represents any object or component of an OS X application which can be manipulated through the OS X Accessibility API -- it can be an application, a window, a button, selected text, etc. As such, it can only support those features and objects within an application that the application developers make available through the Accessibility API.\n\nIn addition to the formal methods described in this documentation, dynamic methods exist for accessing element attributes and actions. These will differ somewhat between objects as the specific attributes and actions will depend upon the accessibility object's role and purpose, but the following outlines the basics.\n\nGetting and Setting Attribute values:\n * `object.attribute` is a shortcut for `object:attributeValue(attribute)`\n * `object.attribute = value` is a shortcut for `object:setAttributeValue(attribute, value)`\n * If detecting accessiblity errors that may occur is necessary, you must use the formal methods [hs.axuielement:attributeValue](#attributeValue) and [hs.axuielement:setAttributeValue](#setAttributeValue)\n * Note that setting an attribute value is not guaranteeed to work with either method:\n * internal logic within the receiving application may decline to accept the newly assigned value\n * an accessibility error may occur\n * the element may not be settable (surprisingly this does not return an error, even when [hs.axuielement:isAttributeSettable](#isAttributeSettable) returns false for the attribute specified)\n * If you require confirmation of the change, you will need to check the value of the attribute with one of the methods described above after setting it.\n\nIteration over Attributes:\n * `for k,v in pairs(object) do ... end` is a shortcut for `for k,_ in ipairs(object:attributeNames()) do local v = object:attributeValue(k) ; ... end` or `for k,v in pairs(object:allAttributeValues()) do ... end` (though see note below)\n * If detecting accessiblity errors that may occur is necessary, you must use one of the formal approaches [hs.axuielement:allAttributeValues](#allAttributeValues) or [hs.axuielement:attributeNames](#attributeNames) and [hs.axuielement:attributeValue](#attributeValue)\n * By default, [hs.axuielement:allAttributeValues](#allAttributeValues) will not include key-value pairs for which the attribute (key) exists for the element but has no assigned value (nil) at the present time. This is because the value of `nil` prevents the key from being retained in the table returned. See [hs.axuielement:allAttributeValues](#allAttributeValues) for details and a workaround.\n\nIteration over Child Elements (AXChildren):\n * `for i,v in ipairs(object) do ... end` is a shortcut for `for i,v in pairs(object:attributeValue(\"AXChildren\") or {}) do ... end`\n * Note that `object:attributeValue(\"AXChildren\")` *may* return nil if the object does not have the `AXChildren` attribute; the shortcut does not have this limitation.\n * `#object` is a shortcut for `#object:attributeValue(\"AXChildren\")`\n * `object[i]` is a shortcut for `object:attributeValue(\"AXChildren\")[i]`\n * If detecting accessiblity errors that may occur is necessary, you must use the formal method [hs.axuielement:attributeValue](#attributeValue) to get the \"AXChildren\" attribute.\n\nActions ([hs.axuielement:actionNames](#actionNames)):\n * `object:do<action>()` is a shortcut for `object:performAction(action)`\n * See [hs.axuielement:performAction](#performAction) for a description of the return values and [hs.axuielement:actionNames](#actionNames) to get a list of actions that the element supports.\n\nParameterizedAttributes:\n * `object:<attribute>WithParameter(value)` is a shortcut for `object:parameterizedAttributeValue(attribute, value)\n * See [hs.axuielement:parameterizedAttributeValue](#parameterizedAttributeValue) for a description of the return values and [hs.axuielement:parameterizedAttributeNames](#parameterizedAttributeNames) to get a list of parameterized values that the element supports\n\n * The specific value required for a each parameterized attribute is different and is often application specific thus requiring some experimentation. Notes regarding identified parameter types and thoughts on some still being investigated will be provided in the Hammerspoon Wiki, hopefully shortly after this module becomes part of a Hammerspoon release.",
"items": [
{
"def": "hs.axuielement:actionDescription(action) -> string | nil, errString",
"desc": "Returns a localized description of the specified accessibility object's action.",
"doc": "Returns a localized description of the specified accessibility object's action.\n\nParameters:\n * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames).\n\nReturns:\n * a string containing a description of the object's action, nil if no description is available, or nil and an error string if an accessibility error occurred\n\nNotes:\n * The action descriptions are provided by the target application; as such their accuracy and usefulness rely on the target application's developers.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "254",
"name": "actionDescription",
"notes": [
" * The action descriptions are provided by the target application; as such their accuracy and usefulness rely on the target application's developers."
],
"parameters": [
" * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames)."
],
"returns": [
" * a string containing a description of the object's action, nil if no description is available, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:actionDescription(action) -> string | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:actionNames() -> table | nil, errString",
"desc": "Returns a list of all the actions the specified accessibility object can perform.",
"doc": "Returns a list of all the actions the specified accessibility object can perform.\n\nParameters:\n * None\n\nReturns:\n * an array of the names of all actions supported by the axuielementObject or nil and an error string if an accessibility error occurred\n\nNotes:\n * Common action names can be found in the [hs.axuielement.actions](#actions) table; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "221",
"name": "actionNames",
"notes": [
" * Common action names can be found in the [hs.axuielement.actions](#actions) table; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table."
],
"parameters": [
" * None"
],
"returns": [
" * an array of the names of all actions supported by the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:actionNames() -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.actions[]",
"desc": "A table of common accessibility object action names, provided for reference.",
"doc": "A table of common accessibility object action names, provided for reference.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.actions`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "966",
"name": "actions",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.actions`"
],
"signature": "hs.axuielement.actions[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement:allAttributeValues([includeErrors]) -> table | nil, errString",
"desc": "Returns a table containing key-value pairs for all attributes of the accessibility object.",
"doc": "Returns a table containing key-value pairs for all attributes of the accessibility object.\n\nParameters:\n * `includeErrors` - an optional boolean, default false, that specifies whether attribute names which generate an error when retrieved are included in the returned results.\n\nReturns:\n * a table with key-value pairs corresponding to the attributes of the accessibility object or nil and an error string if an accessibility error occurred\n\nNotes:\n * if `includeErrors` is not specified or is false, then attributes which exist for the element, but currently have no value assigned, will not appear in the table. This is because Lua treats a nil value for a table's key-value pair as an instruction to remove the key from the table, if it currently exists.\n * To include attributes which exist but are currently unset, you need to specify `includeErrors` as true.\n * attributes for which no value is currently assigned will be given a table value with the following key-value pairs:\n * `_code` = -25212\n * `error` = \"Requested value does not exist\"",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "315",
"name": "allAttributeValues",
"notes": [
" * if `includeErrors` is not specified or is false, then attributes which exist for the element, but currently have no value assigned, will not appear in the table. This is because Lua treats a nil value for a table's key-value pair as an instruction to remove the key from the table, if it currently exists.",
" * To include attributes which exist but are currently unset, you need to specify `includeErrors` as true.",
" * attributes for which no value is currently assigned will be given a table value with the following key-value pairs:",
" * `_code` = -25212",
" * `error` = \"Requested value does not exist\""
],
"parameters": [
" * `includeErrors` - an optional boolean, default false, that specifies whether attribute names which generate an error when retrieved are included in the returned results."
],
"returns": [
" * a table with key-value pairs corresponding to the attributes of the accessibility object or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:allAttributeValues([includeErrors]) -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:allDescendantElements(callback, [withParents]) -> elementSearchObject",
"desc": "Query the accessibility object for all child accessibility objects and their descendants",
"doc": "Query the accessibility object for all child accessibility objects and their descendants\n\nParameters:\n * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the discovered descendant elements. `msg` will be \"completed\" when the traversal has completed normally and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)\n * `withParents` - an optional boolean, default false, indicating that the parent of objects (and their descendants) should be collected as well.\n\nReturns:\n * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)\n\nNotes:\n * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "502",
"name": "allDescendantElements",
"notes": [
" * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments."
],
"parameters": [
" * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the discovered descendant elements. `msg` will be \"completed\" when the traversal has completed normally and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)",
" * `withParents` - an optional boolean, default false, indicating that the parent of objects (and their descendants) should be collected as well."
],
"returns": [
" * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)"
],
"signature": "hs.axuielement:allDescendantElements(callback, [withParents]) -> elementSearchObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.applicationElement(applicationObject) -> axuielementObject",
"desc": "Returns the top-level accessibility object for the application specified by the `hs.application` object.",
"doc": "Returns the top-level accessibility object for the application specified by the `hs.application` object.\n\nParameters:\n * `applicationObject` - the `hs.application` object for the Application or a string or number which will be passed to `hs.application.find` to get an `hs.application` object.\n\nReturns:\n * an axuielementObject for the application specified\n\nNotes:\n * if `applicationObject` is a string or number, only the first item found with `hs.application.find` will be used by this function to create an axuielementObject.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "98",
"name": "applicationElement",
"notes": [
" * if `applicationObject` is a string or number, only the first item found with `hs.application.find` will be used by this function to create an axuielementObject."
],
"parameters": [
" * `applicationObject` - the `hs.application` object for the Application or a string or number which will be passed to `hs.application.find` to get an `hs.application` object."
],
"returns": [
" * an axuielementObject for the application specified"
],
"signature": "hs.axuielement.applicationElement(applicationObject) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.applicationElementForPID(pid) -> axuielementObject",
"desc": "Returns the top-level accessibility object for the application with the specified process ID.",
"doc": "Returns the top-level accessibility object for the application with the specified process ID.\n\nParameters:\n * `pid` - the process ID of the application.\n\nReturns:\n * an axuielementObject for the application specified, or nil if it cannot be determined",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "144",
"name": "applicationElementForPID",
"notes": [],
"parameters": [
" * `pid` - the process ID of the application."
],
"returns": [
" * an axuielementObject for the application specified, or nil if it cannot be determined"
],
"signature": "hs.axuielement.applicationElementForPID(pid) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement:asHSApplication() -> hs.application object | nil",
"desc": "If the element referes to an application, return an `hs.application` object for the element.",
"doc": "If the element referes to an application, return an `hs.application` object for the element.\n\nParameters:\n * None\n\nReturns:\n * if the element refers to an application, return an `hs.application` object for the element ; otherwise return nil\n\nNotes:\n * An element is considered an application by this method if it has an AXRole of AXApplication and has a process identifier (pid).",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "645",
"name": "asHSApplication",
"notes": [
" * An element is considered an application by this method if it has an AXRole of AXApplication and has a process identifier (pid)."
],
"parameters": [
" * None"
],
"returns": [
" * if the element refers to an application, return an `hs.application` object for the element ; otherwise return nil"
],
"signature": "hs.axuielement:asHSApplication() -> hs.application object | nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:asHSWindow() -> hs.window object | nil",
"desc": "If the element referes to a window, return an `hs.window` object for the element.",
"doc": "If the element referes to a window, return an `hs.window` object for the element.\n\nParameters:\n * None\n\nReturns:\n * if the element refers to a window, return an `hs.window` object for the element ; otherwise return nil\n\nNotes:\n * An element is considered a window by this method if it has an AXRole of AXWindow.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "680",
"name": "asHSWindow",
"notes": [
" * An element is considered a window by this method if it has an AXRole of AXWindow."
],
"parameters": [
" * None"
],
"returns": [
" * if the element refers to a window, return an `hs.window` object for the element ; otherwise return nil"
],
"signature": "hs.axuielement:asHSWindow() -> hs.window object | nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:attributeNames() -> table | nil, errString",
"desc": "Returns a list of all the attributes supported by the specified accessibility object.",
"doc": "Returns a list of all the attributes supported by the specified accessibility object.\n\nParameters:\n * None\n\nReturns:\n * an array of the names of all attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred\n\nNotes:\n * Common attribute names can be found in the [hs.axuielement.attributes](#attributes) tables; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "188",
"name": "attributeNames",
"notes": [
" * Common attribute names can be found in the [hs.axuielement.attributes](#attributes) tables; however, this method will list only those names which are supported by this object, and is not limited to just those in the referenced table."
],
"parameters": [
" * None"
],
"returns": [
" * an array of the names of all attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:attributeNames() -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.attributes[]",
"desc": "A table of common accessibility object attribute names which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as keys in the match criteria argument.",
"doc": "A table of common accessibility object attribute names which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as keys in the match criteria argument.\n\nNotes:\n * This table is provided for reference only and is not intended to be comprehensive.\n * You can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.attributes`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "743",
"name": "attributes",
"notes": [
" * This table is provided for reference only and is not intended to be comprehensive.",
" * You can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.attributes`"
],
"signature": "hs.axuielement.attributes[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement:attributeValue(attribute) -> value | nil, errString",
"desc": "Returns the value of an accessibility object's attribute.",
"doc": "Returns the value of an accessibility object's attribute.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n\nReturns:\n * the current value of the attribute, nil if the attribute has no value, or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "286",
"name": "attributeValue",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames)."
],
"returns": [
" * the current value of the attribute, nil if the attribute has no value, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:attributeValue(attribute) -> value | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:attributeValueCount(attribute) -> integer | nil, errString",
"desc": "Returns the count of the array of an accessibility object's attribute value.",
"doc": "Returns the count of the array of an accessibility object's attribute value.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n\nReturns:\n * the number of items in the value for the attribute, if it is an array, or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "365",
"name": "attributeValueCount",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames)."
],
"returns": [
" * the number of items in the value for the attribute, if it is an array, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:attributeValueCount(attribute) -> integer | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:buildTree(callback, [depth], [withParents]) -> elementSearchObject",
"desc": "Captures all of the available information for the accessibility object and its descendants and returns it in a table for inspection.",
"doc": "Captures all of the available information for the accessibility object and its descendants and returns it in a table for inspection.\n\nParameters:\n * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the recorded information. `msg` will be \"completed\" when the search has completed normally (or reached the specified depth) and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)\n * `depth` - an optional integer, default `math.huge`, specifying the maximum depth from the initial accessibility object that should be visited to identify descendant elements and their attributes.\n * `withParents` - an optional boolean, default false, specifying whether or not an element's (or descendant's) attributes for `AXParent` and `AXTopLevelUIElement` should also be visited when identifying additional elements to include in the results table.\n\nReturns:\n * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)\n\nNotes:\n* The format of the `results` table passed to the callback for this method is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.\n * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "478",
"name": "buildTree",
"notes": [
"* The format of the `results` table passed to the callback for this method is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.",
" * This method is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`. Please refer to [hs.axuielement:elementSearch](#elementSearch) for details about the returned object and callback arguments."
],
"parameters": [
" * `callback` - a required function which should expect two arguments: a `msg` string specifying how the search ended, and a table containing the recorded information. `msg` will be \"completed\" when the search has completed normally (or reached the specified depth) and will contain a string starting with \"**\" if it terminates early for some reason (see Notes: section for more information)",
" * `depth` - an optional integer, default `math.huge`, specifying the maximum depth from the initial accessibility object that should be visited to identify descendant elements and their attributes.",
" * `withParents` - an optional boolean, default false, specifying whether or not an element's (or descendant's) attributes for `AXParent` and `AXTopLevelUIElement` should also be visited when identifying additional elements to include in the results table."
],
"returns": [
" * an elementSearchObject as described in [hs.axuielement:elementSearch](#elementSearch)"
],
"signature": "hs.axuielement:buildTree(callback, [depth], [withParents]) -> elementSearchObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:childrenWithRole(role) -> table",
"desc": "Returns a table containing only those immediate children of the element that perform the specified role.",
"doc": "Returns a table containing only those immediate children of the element that perform the specified role.\n\nParameters:\n * `role` - a string specifying the role that the returned children must perform. Example values can be found in [hs.axuielement.roles](#roles).\n\nReturns:\n * a table containing zero or more axuielementObjects.\n\nNotes:\n * only the immediate children of the object are searched.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "972",
"name": "childrenWithRole",
"notes": [
" * only the immediate children of the object are searched."
],
"parameters": [
" * `role` - a string specifying the role that the returned children must perform. Example values can be found in [hs.axuielement.roles](#roles)."
],
"returns": [
" * a table containing zero or more axuielementObjects."
],
"signature": "hs.axuielement:childrenWithRole(role) -> table",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:copy() -> axuielementObject",
"desc": "Return a duplicate userdata reference to the Accessibility object.",
"doc": "Return a duplicate userdata reference to the Accessibility object.\n\nParameters:\n * None\n\nReturns:\n * a new userdata object representing a new reference to the Accessibility object.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "171",
"name": "copy",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a new userdata object representing a new reference to the Accessibility object."
],
"signature": "hs.axuielement:copy() -> axuielementObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:elementAtPosition(x, y | pointTable) -> axuielementObject | nil, errString",
"desc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.",
"doc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.\n\nParameters:\n * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.\n * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.\n * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present.\n\nReturns:\n * an axuielementObject for the object at the specified coordinates, or nil and an error string if no object could be identified or an accessibility error occurred\n\nNotes:\n * This method can only be called on an axuielementObject that represents an application or the system-wide element (see [hs.axuielement.systemWideElement](#systemWideElement)).\n * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location.\n * If this method is called on an axuielementObject representing an application, the search is restricted to the application.\n * If this method is called on an axuielementObject representing the system-wide element, the search is not restricted to any particular application. See [hs.axuielement.systemElementAtPosition](#systemElementAtPosition).",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "533",
"name": "elementAtPosition",
"notes": [
" * This method can only be called on an axuielementObject that represents an application or the system-wide element (see [hs.axuielement.systemWideElement](#systemWideElement)).",
" * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location.",
" * If this method is called on an axuielementObject representing an application, the search is restricted to the application.",
" * If this method is called on an axuielementObject representing the system-wide element, the search is not restricted to any particular application. See [hs.axuielement.systemElementAtPosition](#systemElementAtPosition)."
],
"parameters": [
" * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.",
" * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.",
" * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present."
],
"returns": [
" * an axuielementObject for the object at the specified coordinates, or nil and an error string if no object could be identified or an accessibility error occurred"
],
"signature": "hs.axuielement:elementAtPosition(x, y | pointTable) -> axuielementObject | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:elementSearch(callback, [criteria], [namedModifiers]) -> elementSearchObject",
"desc": "Search for and generate a table of the accessibility elements for the attributes and descendants of this object based on the specified criteria.",
"doc": "Search for and generate a table of the accessibility elements for the attributes and descendants of this object based on the specified criteria.\n\nParameters:\n * `callback` - a (usually) required function which will receive the results of this search. The callback should expect three arguments and return none. The arguments to the callback function will be `msg`, a string specifying how the search ended and `results`, the elementSearchObject containing the requested results, and the number of items added to the results (see `count` in `namedModifiers`). `msg` will be \"completed\" if the search completes normally, or a string starting with \"**\" if it is terminated early (see Returns: and Notes: for more details).\n * `criteria` - an optional function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.\n * `namedModifiers` - an optional table specifying key-value pairs that further modify or control the search. This table may contain 0 or more of the following keys:\n * `count` - an optional integer, default `math.huge`, specifying the maximum number of matches to collect before ending the search and invoking the callback. You can continue the search to find additional elements by invoking `elementSearchObject:next()` (described below in the `Returns` section) on the return value of this method, or on the results argument passed to the callback.\n * `depth` - an optional integer, default `math.huge`, specifying the maximum number of steps (descendants) from the initial accessibility element the search should visit. If you know that your desired element(s) are relatively close to your starting element, setting this to a lower value can significantly speed up the search.\n * The following are also recognized, but may impact the speed of the search, the responsiveness of Hammerspoon, or the format of the results in ways that limit further filtering and are not recommended except when you know that you require them:\n * `asTree` - an optional boolean, default false, and ignored if `criteria` is specified and non-empty, `objectOnly` is true, or `count` is specified. This modifier specifies whether the search results should return as an array table of tables containing each element's details (false) or as a tree where in which the root node details are the key-value pairs of the returned table and descendant elements are likewise described in subtables attached to the attribute name they belong to (true). This format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.\n * `includeParents` - a boolean, default false, specifying whether or not parent attributes (`AXParent` and `AXTopLevelUIElement`) should be examined during the search. Note that in most cases, setting this value to true will end up traversing the entire Accessibility structure for the target application and may significantly slow down the search.\n * `noCallback` - an optional boolean, default false, and ignored if `callback` is not also nil, allowing you to specify nil as the callback when set to true. This feature requires setting this named argumennt to true *and* specifying the callback field as nil because starting a query from an element with a lot of descendants **WILL** block Hammerspoon and slow down the responsiveness of your computer (I've seen blocking for over 5 minutes in extreme cases) and should be used *only* when you know you are starting from close to the end of the element heirarchy.\n * `objectOnly` - an optional boolean, default true, specifying whether each result in the final table will be the accessibility element discovered (true) or a table containing details about the element include the attribute names, actions, etc. for the element (false). This latter format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation.\n\nReturns:\n * an elementSearchObject which contains metamethods allowing you to check to see if the process has completed and cancel it early if desired. The methods include:\n * `elementSearchObject:cancel([reason])` - cancels the current search and invokes the callback with the partial results already collected. If you specify `reason`, the `msg` argument for the callback will be `** <reason>`; otherwise it will be \"** cancelled\".\n * `elementSearchObject:isRunning()` - returns true if the search is currently ongoing or false if it has completed or been cancelled.\n * `elementSearchObject:matched()` - returns an integer specifying the number of elements which have already been found that meet the specified criteria function.\n * `elementSearchObject:runTime()` - returns an integer specifying the number of seconds spent performing this search. Note that this is *not* an accurate measure of how much time a given search will always take because the time will be greatly affected by how much other activity is occurring within Hammerspoon and on the users computer. Resuming a cancelled search or a search which invoked the callback because it reached `count` items with the `next` method (descibed below) will cause this number to begin increasing again to provide a cumulative total of time spent performing the search; time between when the callback is invoked and the `next` method is invoked is not included.\n * `elementSearchObject:visited()` - returns an integer specifying the number of elements which have been examined during the search so far.\n * If `asTree` is false or not specified, the following additional methods will be available:\n * `elementSearchObject:filter(criteria, [callback]) -> filterObject`\n * returns a new table containing elements in the search results that match the specified criteria.\n * `criteria` - a required function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.\n * `callback` - an optional callback which should expect two arguments and return none. If a callback is specified, the callback will receive two arguments, a msg indicating how the callback ended (the message format matches the style defined for this method) and the filterObject which contains the matching elements.\n * The filterObject returned by this method and passed to the callback, if defined, will support the following methods as defined here: `cancel`, `filter`, `isRunning`, `matched`, `runTime`, and `visited`.\n * `elementSearchObject:next()` - if the search was cancelled or reached the count of matches specified, this method will continue the search where it left off. The elementSearchObject returned when the callback is next invoked will have up to `count` items added to the existing results (calls to `next` are cummulative for the total results captured in the elementSearchObject). The third ardument to the callback will be the number of items *added* to the search results, not the number of items *in* the search results.\n\nNotes:\n * This method utilizes coroutines to keep Hammerspoon responsive, but may be slow to complete if `includeParents` is true, if you do not specify `depth`, or if you start from an element that has a lot of descendants (e.g. the application element for a web browser). This is dependent entirely upon how many active accessibility elements the target application defines and where you begin your search and cannot reliably be determined up front, so you may need to experiment to find the best balance for your specific requirements.\n * The search performed is a breadth-first search, so in general earlier elements in the results table will be \"closer\" in the Accessibility hierarchy to the starting point than later elements.\n * The `elementSearchObject` returned by this method and the results passed in as the second argument to the callback function are the same object -- you can use either one in your code depending upon which makes the most sense. Results that match the criteria function are added to the `elementSearchObject` as they are found, so if you examine the object/table returned by this method and determine that you have located the element or elements you require before the callback has been invoked, you can safely invoke the cancel method to end the search early.\n * The exception to this is when `asTree` is true and `objectsOnly` is false and the search criteria is nil -- see [hs.axuielement:buildTree](#buildTree). In this case, the results passed to the callback will be equal to `elementSearchObject[1]`.\n * If `objectsOnly` is specified as false, it may take some time after `cancel` is invoked for the mapping of element attribute tables to the descendant elements in the results set -- this is a by product of the need to iterate through the results to match up all of the instances of each element to it's attribute table.\n * [hs.axuielement:allDescendantElements](#allDescendantElements) is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`\n * [hs.axuielement:buildTree](#buildTree) is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "766",
"name": "elementSearch",
"notes": [
" * This method utilizes coroutines to keep Hammerspoon responsive, but may be slow to complete if `includeParents` is true, if you do not specify `depth`, or if you start from an element that has a lot of descendants (e.g. the application element for a web browser). This is dependent entirely upon how many active accessibility elements the target application defines and where you begin your search and cannot reliably be determined up front, so you may need to experiment to find the best balance for your specific requirements.",
" * The search performed is a breadth-first search, so in general earlier elements in the results table will be \"closer\" in the Accessibility hierarchy to the starting point than later elements.",
" * The `elementSearchObject` returned by this method and the results passed in as the second argument to the callback function are the same object -- you can use either one in your code depending upon which makes the most sense. Results that match the criteria function are added to the `elementSearchObject` as they are found, so if you examine the object/table returned by this method and determine that you have located the element or elements you require before the callback has been invoked, you can safely invoke the cancel method to end the search early.",
" * The exception to this is when `asTree` is true and `objectsOnly` is false and the search criteria is nil -- see [hs.axuielement:buildTree](#buildTree). In this case, the results passed to the callback will be equal to `elementSearchObject[1]`.",
" * If `objectsOnly` is specified as false, it may take some time after `cancel` is invoked for the mapping of element attribute tables to the descendant elements in the results set -- this is a by product of the need to iterate through the results to match up all of the instances of each element to it's attribute table.",
" * [hs.axuielement:allDescendantElements](#allDescendantElements) is syntactic sugar for `hs.axuielement:elementSearch(callback, { [includeParents = withParents] })`",
" * [hs.axuielement:buildTree](#buildTree) is syntactic sugar for `hs.axuielement:elementSearch(callback, { objectOnly = false, asTree = true, [depth = depth], [includeParents = withParents] })`"
],
"parameters": [
" * `callback` - a (usually) required function which will receive the results of this search. The callback should expect three arguments and return none. The arguments to the callback function will be `msg`, a string specifying how the search ended and `results`, the elementSearchObject containing the requested results, and the number of items added to the results (see `count` in `namedModifiers`). `msg` will be \"completed\" if the search completes normally, or a string starting with \"**\" if it is terminated early (see Returns: and Notes: for more details).",
" * `criteria` - an optional function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.",
" * `namedModifiers` - an optional table specifying key-value pairs that further modify or control the search. This table may contain 0 or more of the following keys:\n * `count` - an optional integer, default `math.huge`, specifying the maximum number of matches to collect before ending the search and invoking the callback. You can continue the search to find additional elements by invoking `elementSearchObject:next()` (described below in the `Returns` section) on the return value of this method, or on the results argument passed to the callback.\n * `depth` - an optional integer, default `math.huge`, specifying the maximum number of steps (descendants) from the initial accessibility element the search should visit. If you know that your desired element(s) are relatively close to your starting element, setting this to a lower value can significantly speed up the search.\n * The following are also recognized, but may impact the speed of the search, the responsiveness of Hammerspoon, or the format of the results in ways that limit further filtering and are not recommended except when you know that you require them: * `asTree` - an optional boolean, default false, and ignored if `criteria` is specified and non-empty, `objectOnly` is true, or `count` is specified. This modifier specifies whether the search results should return as an array table of tables containing each element's details (false) or as a tree where in which the root node details are the key-value pairs of the returned table and descendant elements are likewise described in subtables attached to the attribute name they belong to (true). This format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation. * `includeParents` - a boolean, default false, specifying whether or not parent attributes (`AXParent` and `AXTopLevelUIElement`) should be examined during the search. Note that in most cases, setting this value to true will end up traversing the entire Accessibility structure for the target application and may significantly slow down the search. * `noCallback` - an optional boolean, default false, and ignored if `callback` is not also nil, allowing you to specify nil as the callback when set to true. This feature requires setting this named argumennt to true *and* specifying the callback field as nil because starting a query from an element with a lot of descendants **WILL** block Hammerspoon and slow down the responsiveness of your computer (I've seen blocking for over 5 minutes in extreme cases) and should be used *only* when you know you are starting from close to the end of the element heirarchy. * `objectOnly` - an optional boolean, default true, specifying whether each result in the final table will be the accessibility element discovered (true) or a table containing details about the element include the attribute names, actions, etc. for the element (false). This latter format is primarily for debugging and exploratory purposes and may not be arranged for easy programatic evaluation."
],
"returns": [
" * an elementSearchObject which contains metamethods allowing you to check to see if the process has completed and cancel it early if desired. The methods include:",
" * `elementSearchObject:cancel([reason])` - cancels the current search and invokes the callback with the partial results already collected. If you specify `reason`, the `msg` argument for the callback will be `** <reason>`; otherwise it will be \"** cancelled\".",
" * `elementSearchObject:isRunning()` - returns true if the search is currently ongoing or false if it has completed or been cancelled.",
" * `elementSearchObject:matched()` - returns an integer specifying the number of elements which have already been found that meet the specified criteria function.",
" * `elementSearchObject:runTime()` - returns an integer specifying the number of seconds spent performing this search. Note that this is *not* an accurate measure of how much time a given search will always take because the time will be greatly affected by how much other activity is occurring within Hammerspoon and on the users computer. Resuming a cancelled search or a search which invoked the callback because it reached `count` items with the `next` method (descibed below) will cause this number to begin increasing again to provide a cumulative total of time spent performing the search; time between when the callback is invoked and the `next` method is invoked is not included.",
" * `elementSearchObject:visited()` - returns an integer specifying the number of elements which have been examined during the search so far.",
" * If `asTree` is false or not specified, the following additional methods will be available:",
" * `elementSearchObject:filter(criteria, [callback]) -> filterObject`",
" * returns a new table containing elements in the search results that match the specified criteria.",
" * `criteria` - a required function which should accept one argument (the current element being examined) and return true if it should be included in the results or false if it should be rejected. See [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create a search function that uses [hs.axuielement:matchesCriteria](#matchesCriteria) for evaluation.",
" * `callback` - an optional callback which should expect two arguments and return none. If a callback is specified, the callback will receive two arguments, a msg indicating how the callback ended (the message format matches the style defined for this method) and the filterObject which contains the matching elements.",
" * The filterObject returned by this method and passed to the callback, if defined, will support the following methods as defined here: `cancel`, `filter`, `isRunning`, `matched`, `runTime`, and `visited`.",
" * `elementSearchObject:next()` - if the search was cancelled or reached the count of matches specified, this method will continue the search where it left off. The elementSearchObject returned when the callback is next invoked will have up to `count` items added to the existing results (calls to `next` are cummulative for the total results captured in the elementSearchObject). The third ardument to the callback will be the number of items *added* to the search results, not the number of items *in* the search results."
],
"signature": "hs.axuielement:elementSearch(callback, [criteria], [namedModifiers]) -> elementSearchObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:isAttributeSettable(attribute) -> boolean | nil, errString",
"desc": "Returns whether the specified accessibility object's attribute can be modified.",
"doc": "Returns whether the specified accessibility object's attribute can be modified.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n\nReturns:\n * a boolean value indicating whether or not the value of the parameter can be modified or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "421",
"name": "isAttributeSettable",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames)."
],
"returns": [
" * a boolean value indicating whether or not the value of the parameter can be modified or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:isAttributeSettable(attribute) -> boolean | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:isValid() -> boolean | nil, errString",
"desc": "Returns whether the specified accessibility object is still valid.",
"doc": "Returns whether the specified accessibility object is still valid.\n\nParameters:\n * None\n\nReturns:\n * a boolean value indicating whether or not the accessibility object is still valid or nil and an error string if any other accessibility error occurred\n\nNotes:\n * an accessibilityObject can become invalid for a variety of reasons, including but not limited to the element referred to no longer being available (e.g. an element referring to a window or one of its descendants that has been closed) or the application terminating.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "447",
"name": "isValid",
"notes": [
" * an accessibilityObject can become invalid for a variety of reasons, including but not limited to the element referred to no longer being available (e.g. an element referring to a window or one of its descendants that has been closed) or the application terminating."
],
"parameters": [
" * None"
],
"returns": [
" * a boolean value indicating whether or not the accessibility object is still valid or nil and an error string if any other accessibility error occurred"
],
"signature": "hs.axuielement:isValid() -> boolean | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:matchesCriteria(criteria) -> boolean",
"desc": "Returns true if the axuielementObject matches the specified criteria or false if it does not.",
"doc": "Returns true if the axuielementObject matches the specified criteria or false if it does not.\n\nParameters:\n * `criteria` - the criteria to compare against the accessibility object\n\nReturns:\n * true if the axuielementObject matches the criteria, false if it does not.\n\nNotes:\n * the `criteria` argument must be one of the following:\n * a single string, specifying the value the element's AXRole attribute must equal for a positive match\n * an array table of strings specifying a list of possible values the element's AXRole attribute can equal for a positive match\n * a table of key-value pairs specifying a more complex criteria. The table should be defined as follows:\n * one or more of the following must be specified (though all specified must match):\n * `attribute` -- a string, or table of strings, specifying attributes that the element must support.\n * `action` -- a string, or table of strings, specifying actions that the element must be able to perform.\n * `parameterizedAttribute` -- a string, or table of strings, specifying parametrized attributes that the element must support.\n * if the `attribute` key is specified, you can use one of the the following to specify a specific value the attribute must equal for a positive match. No more than one of these should be provided. If neither are present, then only the existence of the attributes specified by `attribute` are required.\n * `value` -- a value, or table of values, that a specifeid attribute must equal. If it's a table, then only one of the values has to match the attribute value for a positive match. Note that if you specify more than one attribute with the `attribute` key, you must provide at least one value for each attribute in this table (order does not matter, but the match will fail if any atrribute does not match at least one value provided).\n * when specifying a value which is itself a table with keys (e.g. frame, size, url, color, etc.) then you *must* provide the value or values as a table of tables, e.g. `{ { y = 22 } }`.\n * only those keys which are specified within the value are checked for equality (or pattern matching). Values which are present in the attribute's value but are not specified in the comparioson value are ignored (i.e. the previous example of `y = 22` would only check the `y` component of an AXFrame attribute -- the `x`, `h`, and `w` values would be ignored).\n * For value compoents which are numeric, e.g. `22` in the previous example, the default comparison is equality. You may change this with the `comparison` key described below in the optional keys.\n * For possible keys when trying to match a color, see the documentation for `hs.drawing.color`.\n * For possible keys when trying to match a URL, use `url = <string>` and/or `filePath = <string>`. The string for the specified table key will be compared in accordance with the `pattern` optional key described below.\n * when specifying a value which is itself a table of values (e.g. a list of axuielementObjects) you *must* provide the value or values as a table of tables, e.g. `{ { obj1, obj2 } }`.\n * Order of the elements provided in the comparison value does not matter -- this only tests for existence within the attributes value.\n * The test is for inclusion only -- the attribute's value may contain other elements as well, but must contain those specified within the comparison value.\n * `nilValue` -- a boolean, specifying that the attributes must not have an assigned value (true) or may be assigned any value except nil (false). If the `value` key is specified, this key is ignored. Note that this applies to *all* of the attributes specified with the `attribute` key.\n * the following are optional keys and are not required:\n * `pattern` -- a boolean, default false, specifying whether string matches for attribute values should be evaluated with `string.match` (true) or as exact matches (false). See the Lua manual, section 6.4.1 (`help.lua._man._6_4_1` in the Hammerspoon console). If the `value` key is not set, than this key is ignored.\n * `invert` -- a boolean, default false, specifying inverted logic for the criteria result --- if this is true and the criteria matches, evaluate criteria as false; otherwise evaluate as true.\n * `comparison` -- a string, default \"==\", specifying the comparison to be used when comparing numeric values. Possible comparison strings are: \"==\" for equality, \"<\" for less than, \"<=\" for less than or equal to, \">\" for greater than, \">=\" for greater than or equal to, or \"~=\" for not equal to.\n\n * an array table of one or more key-value tables as described immediately above; the element must be a positive match for all of the individual criteria tables specified (logical AND).\n * This method is used by [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create criteria functions compatible with [hs.axuielement:elementSearch](#elementSearch).",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "265",
"name": "matchesCriteria",
"notes": [
" * the `criteria` argument must be one of the following:",
" * a single string, specifying the value the element's AXRole attribute must equal for a positive match",
" * an array table of strings specifying a list of possible values the element's AXRole attribute can equal for a positive match",
" * a table of key-value pairs specifying a more complex criteria. The table should be defined as follows:",
" * one or more of the following must be specified (though all specified must match):",
" * `attribute` -- a string, or table of strings, specifying attributes that the element must support.",
" * `action` -- a string, or table of strings, specifying actions that the element must be able to perform.",
" * `parameterizedAttribute` -- a string, or table of strings, specifying parametrized attributes that the element must support.",
" * if the `attribute` key is specified, you can use one of the the following to specify a specific value the attribute must equal for a positive match. No more than one of these should be provided. If neither are present, then only the existence of the attributes specified by `attribute` are required.",
" * `value` -- a value, or table of values, that a specifeid attribute must equal. If it's a table, then only one of the values has to match the attribute value for a positive match. Note that if you specify more than one attribute with the `attribute` key, you must provide at least one value for each attribute in this table (order does not matter, but the match will fail if any atrribute does not match at least one value provided).",
" * when specifying a value which is itself a table with keys (e.g. frame, size, url, color, etc.) then you *must* provide the value or values as a table of tables, e.g. `{ { y = 22 } }`.",
" * only those keys which are specified within the value are checked for equality (or pattern matching). Values which are present in the attribute's value but are not specified in the comparioson value are ignored (i.e. the previous example of `y = 22` would only check the `y` component of an AXFrame attribute -- the `x`, `h`, and `w` values would be ignored).",
" * For value compoents which are numeric, e.g. `22` in the previous example, the default comparison is equality. You may change this with the `comparison` key described below in the optional keys.",
" * For possible keys when trying to match a color, see the documentation for `hs.drawing.color`.",
" * For possible keys when trying to match a URL, use `url = <string>` and/or `filePath = <string>`. The string for the specified table key will be compared in accordance with the `pattern` optional key described below.",
" * when specifying a value which is itself a table of values (e.g. a list of axuielementObjects) you *must* provide the value or values as a table of tables, e.g. `{ { obj1, obj2 } }`.",
" * Order of the elements provided in the comparison value does not matter -- this only tests for existence within the attributes value.",
" * The test is for inclusion only -- the attribute's value may contain other elements as well, but must contain those specified within the comparison value.",
" * `nilValue` -- a boolean, specifying that the attributes must not have an assigned value (true) or may be assigned any value except nil (false). If the `value` key is specified, this key is ignored. Note that this applies to *all* of the attributes specified with the `attribute` key.",
" * the following are optional keys and are not required:",
" * `pattern` -- a boolean, default false, specifying whether string matches for attribute values should be evaluated with `string.match` (true) or as exact matches (false). See the Lua manual, section 6.4.1 (`help.lua._man._6_4_1` in the Hammerspoon console). If the `value` key is not set, than this key is ignored.",
" * `invert` -- a boolean, default false, specifying inverted logic for the criteria result --- if this is true and the criteria matches, evaluate criteria as false; otherwise evaluate as true.",
" * `comparison` -- a string, default \"==\", specifying the comparison to be used when comparing numeric values. Possible comparison strings are: \"==\" for equality, \"<\" for less than, \"<=\" for less than or equal to, \">\" for greater than, \">=\" for greater than or equal to, or \"~=\" for not equal to.",
"",
" * an array table of one or more key-value tables as described immediately above; the element must be a positive match for all of the individual criteria tables specified (logical AND).",
" * This method is used by [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create criteria functions compatible with [hs.axuielement:elementSearch](#elementSearch)."
],
"parameters": [
" * `criteria` - the criteria to compare against the accessibility object"
],
"returns": [
" * true if the axuielementObject matches the criteria, false if it does not."
],
"signature": "hs.axuielement:matchesCriteria(criteria) -> boolean",
"stripped_doc": " * an array table of one or more key-value tables as described immediately above; the element must be a positive match for all of the individual criteria tables specified (logical AND).\n * This method is used by [hs.axuielement.searchCriteriaFunction](#searchCriteriaFunction) to create criteria functions compatible with [hs.axuielement:elementSearch](#elementSearch).",
"type": "Method"
},
{
"def": "hs.axuielement.orientations[]",
"desc": "A table of orientation types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXOrientation\" in the match criteria argument.",
"doc": "A table of orientation types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXOrientation\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.orientations`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1127",
"name": "orientations",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.orientations`"
],
"signature": "hs.axuielement.orientations[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement:parameterizedAttributeNames() -> table | nil, errString",
"desc": "Returns a list of all the parameterized attributes supported by the specified accessibility object.",
"doc": "Returns a list of all the parameterized attributes supported by the specified accessibility object.\n\nParameters:\n * None\n\nReturns:\n * an array of the names of all parameterized attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "391",
"name": "parameterizedAttributeNames",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * an array of the names of all parameterized attributes supported by the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:parameterizedAttributeNames() -> table | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.parameterizedAttributes[]",
"desc": "A table of common accessibility object parameterized attribute names, provided for reference.",
"doc": "A table of common accessibility object parameterized attribute names, provided for reference.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.parameterizedAttributes`\n * Parameterized attributes are attributes that take an argument when querying the element. There is very little documentation available for most of these and application developers can implement their own for which we may never be able to get any documentation. This table contains parameterized attribute names that are defined within the Apple documentation and a few others that have been discovered.\n * Documentation covering what has been discovered through experimentation about paramterized attributes is planned and should be added to the Hammerspoon wiki shortly after this module becomes part of a formal release.",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "926",
"name": "parameterizedAttributes",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.parameterizedAttributes`",
" * Parameterized attributes are attributes that take an argument when querying the element. There is very little documentation available for most of these and application developers can implement their own for which we may never be able to get any documentation. This table contains parameterized attribute names that are defined within the Apple documentation and a few others that have been discovered.",
" * Documentation covering what has been discovered through experimentation about paramterized attributes is planned and should be added to the Hammerspoon wiki shortly after this module becomes part of a formal release."
],
"signature": "hs.axuielement.parameterizedAttributes[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement:parameterizedAttributeValue(attribute, parameter) -> value | nil, errString",
"desc": "Returns the value of an accessibility object's parameterized attribute.",
"doc": "Returns the value of an accessibility object's parameterized attribute.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:parameterizedAttributeNames](#parameterizedAttributeNames).\n * `parameter` - the parameter required by the paramaterized attribute.\n\nReturns:\n * the current value of the parameterized attribute, nil if the parameterized attribute has no value, or nil and an error string if an accessibility error occurred\n\nNotes:\n * The specific parameter required for a each parameterized attribute is different and is often application specific thus requiring some experimentation. Notes regarding identified parameter types and thoughts on some still being investigated will be provided in the Hammerspoon Wiki, hopefully shortly after this module becomes part of a Hammerspoon release.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "582",
"name": "parameterizedAttributeValue",
"notes": [
" * The specific parameter required for a each parameterized attribute is different and is often application specific thus requiring some experimentation. Notes regarding identified parameter types and thoughts on some still being investigated will be provided in the Hammerspoon Wiki, hopefully shortly after this module becomes part of a Hammerspoon release."
],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:parameterizedAttributeNames](#parameterizedAttributeNames).",
" * `parameter` - the parameter required by the paramaterized attribute."
],
"returns": [
" * the current value of the parameterized attribute, nil if the parameterized attribute has no value, or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:parameterizedAttributeValue(attribute, parameter) -> value | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:path() -> table",
"desc": "Returns a table of axuielements tracing this object through its parent objects to the root for this element, most likely an application object or the system wide object.",
"doc": "Returns a table of axuielements tracing this object through its parent objects to the root for this element, most likely an application object or the system wide object.\n\nParameters:\n * None\n\nReturns:\n * a table containing this object and 0 or more parent objects representing the path from the root object to this element.\n\nNotes:\n * this object will always exist as the last element in the table (e.g. at `table[#table]`) with its most immediate parent at `#table - 1`, etc. until the rootmost object for this element is reached at index position 1.\n * an axuielement object representing an application or the system wide object is its own rootmost object and will return a table containing only itself (i.e. `#table` will equal 1)",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "211",
"name": "path",
"notes": [
" * this object will always exist as the last element in the table (e.g. at `table[#table]`) with its most immediate parent at `#table - 1`, etc. until the rootmost object for this element is reached at index position 1.",
" * an axuielement object representing an application or the system wide object is its own rootmost object and will return a table containing only itself (i.e. `#table` will equal 1)"
],
"parameters": [
" * None"
],
"returns": [
" * a table containing this object and 0 or more parent objects representing the path from the root object to this element."
],
"signature": "hs.axuielement:path() -> table",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:performAction(action) -> axuielement | false | nil, errString",
"desc": "Requests that the specified accessibility object perform the specified action.",
"doc": "Requests that the specified accessibility object perform the specified action.\n\nParameters:\n * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames).\n\nReturns:\n * if the requested action was accepted by the target, returns the axuielementObject; if the requested action was rejected, returns false; otherwise returns nil and an error string if an accessibility error occurred\n\nNotes:\n * The return value only suggests success or failure, but is not a guarantee. The receiving application may have internal logic which prevents the action from occurring at this time for some reason, even though this method returns success (the axuielementObject). Contrawise, the requested action may trigger a requirement for a response from the user and thus appear to time out, causing this method to return false or nil.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "503",
"name": "performAction",
"notes": [
" * The return value only suggests success or failure, but is not a guarantee. The receiving application may have internal logic which prevents the action from occurring at this time for some reason, even though this method returns success (the axuielementObject). Contrawise, the requested action may trigger a requirement for a response from the user and thus appear to time out, causing this method to return false or nil."
],
"parameters": [
" * `action` - the name of the action, as specified by [hs.axuielement:actionNames](#actionNames)."
],
"returns": [
" * if the requested action was accepted by the target, returns the axuielementObject; if the requested action was rejected, returns false; otherwise returns nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:performAction(action) -> axuielement | false | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:pid() -> integer | nil, errString",
"desc": "Returns the process ID associated with the specified accessibility object.",
"doc": "Returns the process ID associated with the specified accessibility object.\n\nParameters:\n * None\n\nReturns:\n * the process ID for the application to which the accessibility object ultimately belongs or nil and an error string if an accessibility error occurred",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "478",
"name": "pid",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the process ID for the application to which the accessibility object ultimately belongs or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:pid() -> integer | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.roles[]",
"desc": "A table of common accessibility object roles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXRole\" in the match criteria argument.",
"doc": "A table of common accessibility object roles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXRole\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.roles`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "990",
"name": "roles",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.roles`"
],
"signature": "hs.axuielement.roles[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.rulerMarkers[]",
"desc": "A table of ruler marker types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXMarkerType\" in the match criteria argument.",
"doc": "A table of ruler marker types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXMarkerType\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.rulerMarkers`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1159",
"name": "rulerMarkers",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.rulerMarkers`"
],
"signature": "hs.axuielement.rulerMarkers[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.searchCriteriaFunction(criteria) -> function",
"desc": "Returns a function for use with [hs.axuielement:elementSearch](#elementSearch) that uses [hs.axuielement:matchesCriteria](#matchesCriteria) with the specified criteria.",
"doc": "Returns a function for use with [hs.axuielement:elementSearch](#elementSearch) that uses [hs.axuielement:matchesCriteria](#matchesCriteria) with the specified criteria.\n\nParameters:\n * `criteria` - a criteria definition as defined for the [hs.axuielement:matchesCriteria](#matchesCriteria) method.\n\nReturns:\n * a function which can be used as the `criteriaFunction` for [hs.axuielement:elementSearch](#elementSearch).",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "464",
"name": "searchCriteriaFunction",
"notes": [],
"parameters": [
" * `criteria` - a criteria definition as defined for the [hs.axuielement:matchesCriteria](#matchesCriteria) method."
],
"returns": [
" * a function which can be used as the `criteriaFunction` for [hs.axuielement:elementSearch](#elementSearch)."
],
"signature": "hs.axuielement.searchCriteriaFunction(criteria) -> function",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement:setAttributeValue(attribute, value) -> axuielementObject | nil, errString",
"desc": "Sets the accessibility object's attribute to the specified value.",
"doc": "Sets the accessibility object's attribute to the specified value.\n\nParameters:\n * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).\n * `value` - the value to assign to the attribute\n\nReturns:\n * the axuielementObject on success; nil and an error string if the attribute could not be set or an accessibility error occurred.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "617",
"name": "setAttributeValue",
"notes": [],
"parameters": [
" * `attribute` - the name of the attribute, as specified by [hs.axuielement:attributeNames](#attributeNames).",
" * `value` - the value to assign to the attribute"
],
"returns": [
" * the axuielementObject on success; nil and an error string if the attribute could not be set or an accessibility error occurred."
],
"signature": "hs.axuielement:setAttributeValue(attribute, value) -> axuielementObject | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement:setTimeout(value) -> axuielementObject | nil, errString",
"desc": "Sets the timeout value used accessibility queries performed from this element.",
"doc": "Sets the timeout value used accessibility queries performed from this element.\n\nParameters:\n * `value` - the number of seconds for the new timeout value. Must be 0 or positive.\n\nReturns:\n * the axuielementObject or nil and an error string if an accessibility error occurred\n\nNotes:\n * To change the global timeout affecting all queries on elements which do not have a specific timeout set, use this method on the systemwide element (see [hs.axuielement.systemWideElement](#systemWideElement).\n * Changing the timeout value for an axuielement object only changes the value for that specific element -- other axuieleement objects that may refer to the identical accessibiity item are not affected.\n * Setting the value to 0.0 resets the timeout -- if applied to the `systemWideElement`, the global default will be reset to its default value; if applied to another axuielement object, the timeout will be reset to the current global value as applied to the systemWideElement.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "710",
"name": "setTimeout",
"notes": [
" * To change the global timeout affecting all queries on elements which do not have a specific timeout set, use this method on the systemwide element (see [hs.axuielement.systemWideElement](#systemWideElement).",
" * Changing the timeout value for an axuielement object only changes the value for that specific element -- other axuieleement objects that may refer to the identical accessibiity item are not affected.",
" * Setting the value to 0.0 resets the timeout -- if applied to the `systemWideElement`, the global default will be reset to its default value; if applied to another axuielement object, the timeout will be reset to the current global value as applied to the systemWideElement."
],
"parameters": [
" * `value` - the number of seconds for the new timeout value. Must be 0 or positive."
],
"returns": [
" * the axuielementObject or nil and an error string if an accessibility error occurred"
],
"signature": "hs.axuielement:setTimeout(value) -> axuielementObject | nil, errString",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.sortDirections[]",
"desc": "A table of sort direction types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSortDirection\" in the match criteria argument.",
"doc": "A table of sort direction types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSortDirection\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.sortDirections`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1143",
"name": "sortDirections",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.sortDirections`"
],
"signature": "hs.axuielement.sortDirections[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.subroles[]",
"desc": "A table of common accessibility object subroles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSubrole\" in the match criteria argument.",
"doc": "A table of common accessibility object subroles which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for \"AXSubrole\" in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and is not intended to be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.subroles`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1067",
"name": "subroles",
"notes": [
" * this table is provided for reference only and is not intended to be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.subroles`"
],
"signature": "hs.axuielement.subroles[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.systemElementAtPosition(x, y | pointTable) -> axuielementObject",
"desc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.",
"doc": "Returns the accessibility object at the specified position on the screen. The top-left corner of the primary screen is 0, 0.\n\nParameters:\n * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.\n * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.\n * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present.\n\nReturns:\n * an axuielementObject for the object at the specified coordinates, or nil if no object could be identified.\n\nNotes:\n * See also [hs.axuielement:elementAtPosition](#elementAtPosition) -- this function is a shortcut for `hs.axuielement.systemWideElement():elementAtPosition(...)`.\n * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location.",
"examples": [],
"file": "extensions/axuielement/axuielement.lua",
"lineno": "86",
"name": "systemElementAtPosition",
"notes": [
" * See also [hs.axuielement:elementAtPosition](#elementAtPosition) -- this function is a shortcut for `hs.axuielement.systemWideElement():elementAtPosition(...)`.",
" * This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified location."
],
"parameters": [
" * `x` - the x coordinate of the screen location to test. If this parameter is provided, then the `y` parameter must also be provided and the `pointTable` parameter must not be provided.",
" * `y` - the y coordinate of the screen location to test. This parameter is required if the `x` parameter is provided.",
" * `pointTable` - the x and y coordinates of the screen location to test provided as a point-table, like the one returned by `hs.mouse.getAbsolutePosition` (a point-table is a table with key-value pairs for keys `x` and `y`). If this parameter is provided, then separate `x` and `y` parameters must not also be present."
],
"returns": [
" * an axuielementObject for the object at the specified coordinates, or nil if no object could be identified."
],
"signature": "hs.axuielement.systemElementAtPosition(x, y | pointTable) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.systemWideElement() -> axuielementObject",
"desc": "Returns an accessibility object that provides access to system attributes.",
"doc": "Returns an accessibility object that provides access to system attributes.\n\nParameters:\n * None\n\nReturns:\n * the axuielementObject for the system attributes",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "126",
"name": "systemWideElement",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the axuielementObject for the system attributes"
],
"signature": "hs.axuielement.systemWideElement() -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.units[]",
"desc": "A table of measurement unit types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for attributes which specify measurement unit types (e.g. \"AXUnits\", \"AXHorizontalUnits\", and \"AXVerticalUnits\") in the match criteria argument.",
"doc": "A table of measurement unit types which may be used with [hs.axuielement:elementSearch](#elementSearch) or [hs.axuielement:matchesCriteria](#matchesCriteria) as attribute values for attributes which specify measurement unit types (e.g. \"AXUnits\", \"AXHorizontalUnits\", and \"AXVerticalUnits\") in the match criteria argument.\n\nNotes:\n * this table is provided for reference only and may not be comprehensive.\n * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.units`",
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "1180",
"name": "units",
"notes": [
" * this table is provided for reference only and may not be comprehensive.",
" * you can view the contents of this table from the Hammerspoon console by typing in `hs.axuielement.units`"
],
"signature": "hs.axuielement.units[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.windowElement(windowObject) -> axuielementObject",
"desc": "Returns the accessibility object for the window specified by the `hs.window` object.",
"doc": "Returns the accessibility object for the window specified by the `hs.window` object.\n\nParameters:\n * `windowObject` - the `hs.window` object for the window or a string or number which will be passed to `hs.window.find` to get an `hs.window` object.\n\nReturns:\n * an axuielementObject for the window specified\n\nNotes:\n * if `windowObject` is a string or number, only the first item found with `hs.window.find` will be used by this function to create an axuielementObject.",
"examples": [],
"file": "extensions/axuielement/libaxuielement.m",
"lineno": "70",
"name": "windowElement",
"notes": [
" * if `windowObject` is a string or number, only the first item found with `hs.window.find` will be used by this function to create an axuielementObject."
],
"parameters": [
" * `windowObject` - the `hs.window` object for the window or a string or number which will be passed to `hs.window.find` to get an `hs.window` object."
],
"returns": [
" * an axuielementObject for the window specified"
],
"signature": "hs.axuielement.windowElement(windowObject) -> axuielementObject",
"stripped_doc": "",
"type": "Constructor"
}
],
"name": "hs.axuielement",
"stripped_doc": "\nThis module works through the use of axuielementObjects, which is the Hammerspoon representation for an accessibility object. An accessibility object represents any object or component of an OS X application which can be manipulated through the OS X Accessibility API -- it can be an application, a window, a button, selected text, etc. As such, it can only support those features and objects within an application that the application developers make available through the Accessibility API.\n\nIn addition to the formal methods described in this documentation, dynamic methods exist for accessing element attributes and actions. These will differ somewhat between objects as the specific attributes and actions will depend upon the accessibility object's role and purpose, but the following outlines the basics.\n\nGetting and Setting Attribute values:\n * `object.attribute` is a shortcut for `object:attributeValue(attribute)`\n * `object.attribute = value` is a shortcut for `object:setAttributeValue(attribute, value)`\n * If detecting accessiblity errors that may occur is necessary, you must use the formal methods [hs.axuielement:attributeValue](#attributeValue) and [hs.axuielement:setAttributeValue](#setAttributeValue)\n * Note that setting an attribute value is not guaranteeed to work with either method:\n * internal logic within the receiving application may decline to accept the newly assigned value\n * an accessibility error may occur\n * the element may not be settable (surprisingly this does not return an error, even when [hs.axuielement:isAttributeSettable](#isAttributeSettable) returns false for the attribute specified)\n * If you require confirmation of the change, you will need to check the value of the attribute with one of the methods described above after setting it.\n\nIteration over Attributes:\n * `for k,v in pairs(object) do ... end` is a shortcut for `for k,_ in ipairs(object:attributeNames()) do local v = object:attributeValue(k) ; ... end` or `for k,v in pairs(object:allAttributeValues()) do ... end` (though see note below)\n * If detecting accessiblity errors that may occur is necessary, you must use one of the formal approaches [hs.axuielement:allAttributeValues](#allAttributeValues) or [hs.axuielement:attributeNames](#attributeNames) and [hs.axuielement:attributeValue](#attributeValue)\n * By default, [hs.axuielement:allAttributeValues](#allAttributeValues) will not include key-value pairs for which the attribute (key) exists for the element but has no assigned value (nil) at the present time. This is because the value of `nil` prevents the key from being retained in the table returned. See [hs.axuielement:allAttributeValues](#allAttributeValues) for details and a workaround.\n\nIteration over Child Elements (AXChildren):\n * `for i,v in ipairs(object) do ... end` is a shortcut for `for i,v in pairs(object:attributeValue(\"AXChildren\") or {}) do ... end`\n * Note that `object:attributeValue(\"AXChildren\")` *may* return nil if the object does not have the `AXChildren` attribute; the shortcut does not have this limitation.\n * `#object` is a shortcut for `#object:attributeValue(\"AXChildren\")`\n * `object[i]` is a shortcut for `object:attributeValue(\"AXChildren\")[i]`\n * If detecting accessiblity errors that may occur is necessary, you must use the formal method [hs.axuielement:attributeValue](#attributeValue) to get the \"AXChildren\" attribute.\n\nActions ([hs.axuielement:actionNames](#actionNames)):\n * `object:do<action>()` is a shortcut for `object:performAction(action)`\n * See [hs.axuielement:performAction](#performAction) for a description of the return values and [hs.axuielement:actionNames](#actionNames) to get a list of actions that the element supports.\n\nParameterizedAttributes:\n * `object:<attribute>WithParameter(value)` is a shortcut for `object:parameterizedAttributeValue(attribute, value)\n * See [hs.axuielement:parameterizedAttributeValue](#parameterizedAttributeValue) for a description of the return values and [hs.axuielement:parameterizedAttributeNames](#parameterizedAttributeNames) to get a list of parameterized values that the element supports\n\n * The specific value required for a each parameterized attribute is different and is often application specific thus requiring some experimentation. Notes regarding identified parameter types and thoughts on some still being investigated will be provided in the Hammerspoon Wiki, hopefully shortly after this module becomes part of a Hammerspoon release.",
"submodules": [
"axtextmarker",
"observer"
],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [
{
"def": "hs.axuielement.axtextmarker.newMarker(string) -> axTextMarkerObject | nil, errorString",
"desc": "Creates a new AXTextMarker object from the string of binary data provided",
"doc": "Creates a new AXTextMarker object from the string of binary data provided\n\nParameters:\n * `string` - a string containing 1 or more bytes of data for the AXTextMarker object\n\nReturns:\n * a new axTextMarkerObject or nil and a string description if there was an error\n\nNotes:\n * This function is included primarily for testing and debugging purposes -- in general you will probably never use this constructor; AXTextMarker objects appear to be mostly application dependant and have no meaning external to the application from which it was created.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "43",
"name": "newMarker",
"notes": [
" * This function is included primarily for testing and debugging purposes -- in general you will probably never use this constructor; AXTextMarker objects appear to be mostly application dependant and have no meaning external to the application from which it was created."
],
"parameters": [
" * `string` - a string containing 1 or more bytes of data for the AXTextMarker object"
],
"returns": [
" * a new axTextMarkerObject or nil and a string description if there was an error"
],
"signature": "hs.axuielement.axtextmarker.newMarker(string) -> axTextMarkerObject | nil, errorString",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.axtextmarker.newRange(startMarker, endMarker) -> axTextMarkerRangeObject | nil, errorString",
"desc": "Creates a new AXTextMarkerRange object from the start and end markers provided",
"doc": "Creates a new AXTextMarkerRange object from the start and end markers provided\n\nParameters:\n * `startMarker` - an axTextMarkerObject representing the start of the range to be created\n * `endMarker` - an axTextMarkerObject representing the end of the range to be created\n\nReturns:\n * a new axTextMarkerRangeObject or nil and a string description if there was an error\n\nNotes:\n * this constructor can be used to create a range from axTextMarkerObjects obtained from an application to specify a new range for a paramterized attribute. As a simple example (it is hoped that more will be added to the Hammerspoon wiki shortly):\n ```lua\n s = hs.axuielement.applicationElement(hs.application(\"Safari\"))\n -- for a window displaying the DuckDuckGo main search page, this gets the\n -- primary display area. Other pages may vary and you should build your\n -- object as necessary for your target.\n c = s(\"AXMainWindow\")(\"AXSections\")[1].SectionObject[1][1]\n start = c(\"AXStartTextMarker\") -- get the text marker for the start of this element\n ending = c(\"AXNextLineEndTextMarkerForTextMarker\", start) -- get the next end of line marker\n print(c(\"AXStringForTextMarkerRange\", hs.axuielement.axtextmarker.newRange(start, ending)))\n -- outputs \"Privacy, simplified.\" to the Hammerspoon console```\n * The specific attributes and parameterized attributes supported by a given application differ and can be discovered with the `hs.axuielement:getAttributeNames` and `hs.axuielement:getParameterizedAttributeNames` methods.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "73",
"name": "newRange",
"notes": [
" * this constructor can be used to create a range from axTextMarkerObjects obtained from an application to specify a new range for a paramterized attribute. As a simple example (it is hoped that more will be added to the Hammerspoon wiki shortly):",
" ```lua",
" s = hs.axuielement.applicationElement(hs.application(\"Safari\"))",
" -- for a window displaying the DuckDuckGo main search page, this gets the",
" -- primary display area. Other pages may vary and you should build your",
" -- object as necessary for your target.",
" c = s(\"AXMainWindow\")(\"AXSections\")[1].SectionObject[1][1]",
" start = c(\"AXStartTextMarker\") -- get the text marker for the start of this element",
" ending = c(\"AXNextLineEndTextMarkerForTextMarker\", start) -- get the next end of line marker",
" print(c(\"AXStringForTextMarkerRange\", hs.axuielement.axtextmarker.newRange(start, ending)))",
" -- outputs \"Privacy, simplified.\" to the Hammerspoon console```",
" * The specific attributes and parameterized attributes supported by a given application differ and can be discovered with the `hs.axuielement:getAttributeNames` and `hs.axuielement:getParameterizedAttributeNames` methods."
],
"parameters": [
" * `startMarker` - an axTextMarkerObject representing the start of the range to be created",
" * `endMarker` - an axTextMarkerObject representing the end of the range to be created"
],
"returns": [
" * a new axTextMarkerRangeObject or nil and a string description if there was an error"
],
"signature": "hs.axuielement.axtextmarker.newRange(startMarker, endMarker) -> axTextMarkerRangeObject | nil, errorString",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.axuielement.axtextmarker._functionCheck() -> table",
"desc": "Returns a table of the AXTextMarker and AXTextMarkerRange functions that have been discovered and are used within this module.",
"doc": "Returns a table of the AXTextMarker and AXTextMarkerRange functions that have been discovered and are used within this module.\n\nParameters:\n * None\n\nReturns:\n * a table with key-value pairs where the keys correspond to the undocumented Core Foundation functions required by this module to support AXTextMarker and AXTextMarkerRange and the value will be a boolean indicating whether the function exists in the currently loaded frameworks.\n\nNotes:\n * the functions are defined within the HIServices framework which is part of the ApplicationServices framework, so it is expected that the necessary functions will always be available; however, if you ever receive an error message from a function or method within this submodule of the form \"CF function AX... undefined\", please see the submodule heading documentation for a description of the information, including that which this function provides, that should be included in any error report you submit.\n * This is for debugging purposes and is not expected to be used often.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "153",
"name": "_functionCheck",
"notes": [
" * the functions are defined within the HIServices framework which is part of the ApplicationServices framework, so it is expected that the necessary functions will always be available; however, if you ever receive an error message from a function or method within this submodule of the form \"CF function AX... undefined\", please see the submodule heading documentation for a description of the information, including that which this function provides, that should be included in any error report you submit.",
" * This is for debugging purposes and is not expected to be used often."
],
"parameters": [
" * None"
],
"returns": [
" * a table with key-value pairs where the keys correspond to the undocumented Core Foundation functions required by this module to support AXTextMarker and AXTextMarkerRange and the value will be a boolean indicating whether the function exists in the currently loaded frameworks."
],
"signature": "hs.axuielement.axtextmarker._functionCheck() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:bytes() -> string | nil, errorString",
"desc": "Returns a string containing the opaque binary data contained within the axTextMarkerObject",
"doc": "Returns a string containing the opaque binary data contained within the axTextMarkerObject\n\nParameters:\n * None\n\nReturns:\n * a string containing the opaque binary data contained within the axTextMarkerObject\n\nNotes:\n * the string will likely contain invalid UTF8 code sequences or unprintable ascii values; to see the data in decimal or hexidecimal form you can use:\n string.byte(hs.axuielement.axtextmarker:bytes(), 1, hs.axuielement.axtextmarker:length())\n -- or\n hs.utf8.hexDump(hs.axuielement.axtextmarker:bytes())\n * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "184",
"name": "bytes",
"notes": [
" * the string will likely contain invalid UTF8 code sequences or unprintable ascii values; to see the data in decimal or hexidecimal form you can use:",
" string.byte(hs.axuielement.axtextmarker:bytes(), 1, hs.axuielement.axtextmarker:length())",
" -- or",
" hs.utf8.hexDump(hs.axuielement.axtextmarker:bytes())",
" * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes."
],
"parameters": [
" * None"
],
"returns": [
" * a string containing the opaque binary data contained within the axTextMarkerObject"
],
"signature": "hs.axuielement.axtextmarker:bytes() -> string | nil, errorString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:endMarker() -> axTextMarkerObject | nil, errorString",
"desc": "Returns the ending marker for an axTextMarkerRangeObject",
"doc": "Returns the ending marker for an axTextMarkerRangeObject\n\nParameters:\n * None\n\nReturns:\n * the ending marker for an axTextMarkerRangeObject",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "263",
"name": "endMarker",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the ending marker for an axTextMarkerRangeObject"
],
"signature": "hs.axuielement.axtextmarker:endMarker() -> axTextMarkerObject | nil, errorString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:length() -> integer | nil, errorString",
"desc": "Returns an integer specifying the number of bytes in the data portion of the axTextMarkerObject.",
"doc": "Returns an integer specifying the number of bytes in the data portion of the axTextMarkerObject.\n\nParameters:\n * None\n\nReturns:\n * an integer specifying the number of bytes in the data portion of the axTextMarkerObject\n\nNotes:\n * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "210",
"name": "length",
"notes": [
" * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes."
],
"parameters": [
" * None"
],
"returns": [
" * an integer specifying the number of bytes in the data portion of the axTextMarkerObject"
],
"signature": "hs.axuielement.axtextmarker:length() -> integer | nil, errorString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:startMarker() -> axTextMarkerObject | nil, errorString",
"desc": "Returns the starting marker for an axTextMarkerRangeObject",
"doc": "Returns the starting marker for an axTextMarkerRangeObject\n\nParameters:\n * None\n\nReturns:\n * the starting marker for an axTextMarkerRangeObject",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "231",
"name": "startMarker",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the starting marker for an axTextMarkerRangeObject"
],
"signature": "hs.axuielement.axtextmarker:startMarker() -> axTextMarkerObject | nil, errorString",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "This submodule allows hs.axuielement to support using AXTextMarker and AXTextMarkerRange objects as parameters for parameterized Accessibility attributes with applications that support them.",
"doc": "This submodule allows hs.axuielement to support using AXTextMarker and AXTextMarkerRange objects as parameters for parameterized Accessibility attributes with applications that support them.\n\nMost Accessibility object values correspond to the common data types found in most programming languages -- strings, numbers, tables (arrays and dictionaries), etc. AXTextMarker and AXTextMarkerRange types are application specific and do not have a direct mapping to a simple data type. The description I've found most apt comes from comments within the Chromium source for the Mac version of their browser:\n\n> // A serialization of a position as POD. Not for sharing on disk or sharing\n> // across thread or process boundaries, just for passing a position to an\n> // API that works with positions as opaque objects.\n\nThis submodule allows Lua to represent these as userdata which can be passed in to parameterized attributes for the appliction from which they were retrieved. Examples are expected to be added to the Hammerspoon wiki soon.\n\nAs this submodule utilizes private and undocumented functions in the HIServices framework, if you receive an error using any of these functions or methods indicating an undefined CF function (the function or method will return nil and a string of the format \"CF function AX... undefined\"), please make sure to include the output of the following in any issue you submit to the Hammerspoon github page (enter these into the Hammerspoon console):\n\n hs.inspect(hs.axuielement.axtextmarker._functionCheck())\n hs.inspect(hs.processInfo)\n hs.host.operatingSystemVersionString()",
"items": [
{
"def": "hs.axuielement.axtextmarker._functionCheck() -> table",
"desc": "Returns a table of the AXTextMarker and AXTextMarkerRange functions that have been discovered and are used within this module.",
"doc": "Returns a table of the AXTextMarker and AXTextMarkerRange functions that have been discovered and are used within this module.\n\nParameters:\n * None\n\nReturns:\n * a table with key-value pairs where the keys correspond to the undocumented Core Foundation functions required by this module to support AXTextMarker and AXTextMarkerRange and the value will be a boolean indicating whether the function exists in the currently loaded frameworks.\n\nNotes:\n * the functions are defined within the HIServices framework which is part of the ApplicationServices framework, so it is expected that the necessary functions will always be available; however, if you ever receive an error message from a function or method within this submodule of the form \"CF function AX... undefined\", please see the submodule heading documentation for a description of the information, including that which this function provides, that should be included in any error report you submit.\n * This is for debugging purposes and is not expected to be used often.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "153",
"name": "_functionCheck",
"notes": [
" * the functions are defined within the HIServices framework which is part of the ApplicationServices framework, so it is expected that the necessary functions will always be available; however, if you ever receive an error message from a function or method within this submodule of the form \"CF function AX... undefined\", please see the submodule heading documentation for a description of the information, including that which this function provides, that should be included in any error report you submit.",
" * This is for debugging purposes and is not expected to be used often."
],
"parameters": [
" * None"
],
"returns": [
" * a table with key-value pairs where the keys correspond to the undocumented Core Foundation functions required by this module to support AXTextMarker and AXTextMarkerRange and the value will be a boolean indicating whether the function exists in the currently loaded frameworks."
],
"signature": "hs.axuielement.axtextmarker._functionCheck() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:bytes() -> string | nil, errorString",
"desc": "Returns a string containing the opaque binary data contained within the axTextMarkerObject",
"doc": "Returns a string containing the opaque binary data contained within the axTextMarkerObject\n\nParameters:\n * None\n\nReturns:\n * a string containing the opaque binary data contained within the axTextMarkerObject\n\nNotes:\n * the string will likely contain invalid UTF8 code sequences or unprintable ascii values; to see the data in decimal or hexidecimal form you can use:\n string.byte(hs.axuielement.axtextmarker:bytes(), 1, hs.axuielement.axtextmarker:length())\n -- or\n hs.utf8.hexDump(hs.axuielement.axtextmarker:bytes())\n * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "184",
"name": "bytes",
"notes": [
" * the string will likely contain invalid UTF8 code sequences or unprintable ascii values; to see the data in decimal or hexidecimal form you can use:",
" string.byte(hs.axuielement.axtextmarker:bytes(), 1, hs.axuielement.axtextmarker:length())",
" -- or",
" hs.utf8.hexDump(hs.axuielement.axtextmarker:bytes())",
" * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes."
],
"parameters": [
" * None"
],
"returns": [
" * a string containing the opaque binary data contained within the axTextMarkerObject"
],
"signature": "hs.axuielement.axtextmarker:bytes() -> string | nil, errorString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:endMarker() -> axTextMarkerObject | nil, errorString",
"desc": "Returns the ending marker for an axTextMarkerRangeObject",
"doc": "Returns the ending marker for an axTextMarkerRangeObject\n\nParameters:\n * None\n\nReturns:\n * the ending marker for an axTextMarkerRangeObject",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "263",
"name": "endMarker",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the ending marker for an axTextMarkerRangeObject"
],
"signature": "hs.axuielement.axtextmarker:endMarker() -> axTextMarkerObject | nil, errorString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker:length() -> integer | nil, errorString",
"desc": "Returns an integer specifying the number of bytes in the data portion of the axTextMarkerObject.",
"doc": "Returns an integer specifying the number of bytes in the data portion of the axTextMarkerObject.\n\nParameters:\n * None\n\nReturns:\n * an integer specifying the number of bytes in the data portion of the axTextMarkerObject\n\nNotes:\n * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "210",
"name": "length",
"notes": [
" * As the data is application specific, it is unlikely that you will use this method often; it is included primarily for testing and debugging purposes."
],
"parameters": [
" * None"
],
"returns": [
" * an integer specifying the number of bytes in the data portion of the axTextMarkerObject"
],
"signature": "hs.axuielement.axtextmarker:length() -> integer | nil, errorString",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.axuielement.axtextmarker.newMarker(string) -> axTextMarkerObject | nil, errorString",
"desc": "Creates a new AXTextMarker object from the string of binary data provided",
"doc": "Creates a new AXTextMarker object from the string of binary data provided\n\nParameters:\n * `string` - a string containing 1 or more bytes of data for the AXTextMarker object\n\nReturns:\n * a new axTextMarkerObject or nil and a string description if there was an error\n\nNotes:\n * This function is included primarily for testing and debugging purposes -- in general you will probably never use this constructor; AXTextMarker objects appear to be mostly application dependant and have no meaning external to the application from which it was created.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "43",
"name": "newMarker",
"notes": [
" * This function is included primarily for testing and debugging purposes -- in general you will probably never use this constructor; AXTextMarker objects appear to be mostly application dependant and have no meaning external to the application from which it was created."
],
"parameters": [
" * `string` - a string containing 1 or more bytes of data for the AXTextMarker object"
],
"returns": [
" * a new axTextMarkerObject or nil and a string description if there was an error"
],
"signature": "hs.axuielement.axtextmarker.newMarker(string) -> axTextMarkerObject | nil, errorString",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.axtextmarker.newRange(startMarker, endMarker) -> axTextMarkerRangeObject | nil, errorString",
"desc": "Creates a new AXTextMarkerRange object from the start and end markers provided",
"doc": "Creates a new AXTextMarkerRange object from the start and end markers provided\n\nParameters:\n * `startMarker` - an axTextMarkerObject representing the start of the range to be created\n * `endMarker` - an axTextMarkerObject representing the end of the range to be created\n\nReturns:\n * a new axTextMarkerRangeObject or nil and a string description if there was an error\n\nNotes:\n * this constructor can be used to create a range from axTextMarkerObjects obtained from an application to specify a new range for a paramterized attribute. As a simple example (it is hoped that more will be added to the Hammerspoon wiki shortly):\n ```lua\n s = hs.axuielement.applicationElement(hs.application(\"Safari\"))\n -- for a window displaying the DuckDuckGo main search page, this gets the\n -- primary display area. Other pages may vary and you should build your\n -- object as necessary for your target.\n c = s(\"AXMainWindow\")(\"AXSections\")[1].SectionObject[1][1]\n start = c(\"AXStartTextMarker\") -- get the text marker for the start of this element\n ending = c(\"AXNextLineEndTextMarkerForTextMarker\", start) -- get the next end of line marker\n print(c(\"AXStringForTextMarkerRange\", hs.axuielement.axtextmarker.newRange(start, ending)))\n -- outputs \"Privacy, simplified.\" to the Hammerspoon console```\n * The specific attributes and parameterized attributes supported by a given application differ and can be discovered with the `hs.axuielement:getAttributeNames` and `hs.axuielement:getParameterizedAttributeNames` methods.",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "73",
"name": "newRange",
"notes": [
" * this constructor can be used to create a range from axTextMarkerObjects obtained from an application to specify a new range for a paramterized attribute. As a simple example (it is hoped that more will be added to the Hammerspoon wiki shortly):",
" ```lua",
" s = hs.axuielement.applicationElement(hs.application(\"Safari\"))",
" -- for a window displaying the DuckDuckGo main search page, this gets the",
" -- primary display area. Other pages may vary and you should build your",
" -- object as necessary for your target.",
" c = s(\"AXMainWindow\")(\"AXSections\")[1].SectionObject[1][1]",
" start = c(\"AXStartTextMarker\") -- get the text marker for the start of this element",
" ending = c(\"AXNextLineEndTextMarkerForTextMarker\", start) -- get the next end of line marker",
" print(c(\"AXStringForTextMarkerRange\", hs.axuielement.axtextmarker.newRange(start, ending)))",
" -- outputs \"Privacy, simplified.\" to the Hammerspoon console```",
" * The specific attributes and parameterized attributes supported by a given application differ and can be discovered with the `hs.axuielement:getAttributeNames` and `hs.axuielement:getParameterizedAttributeNames` methods."
],
"parameters": [
" * `startMarker` - an axTextMarkerObject representing the start of the range to be created",
" * `endMarker` - an axTextMarkerObject representing the end of the range to be created"
],
"returns": [
" * a new axTextMarkerRangeObject or nil and a string description if there was an error"
],
"signature": "hs.axuielement.axtextmarker.newRange(startMarker, endMarker) -> axTextMarkerRangeObject | nil, errorString",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.axtextmarker:startMarker() -> axTextMarkerObject | nil, errorString",
"desc": "Returns the starting marker for an axTextMarkerRangeObject",
"doc": "Returns the starting marker for an axTextMarkerRangeObject\n\nParameters:\n * None\n\nReturns:\n * the starting marker for an axTextMarkerRangeObject",
"examples": [],
"file": "extensions/axuielement/axtextmarker.m",
"lineno": "231",
"name": "startMarker",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * the starting marker for an axTextMarkerRangeObject"
],
"signature": "hs.axuielement.axtextmarker:startMarker() -> axTextMarkerObject | nil, errorString",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.axuielement.axtextmarker",
"stripped_doc": "\nMost Accessibility object values correspond to the common data types found in most programming languages -- strings, numbers, tables (arrays and dictionaries), etc. AXTextMarker and AXTextMarkerRange types are application specific and do not have a direct mapping to a simple data type. The description I've found most apt comes from comments within the Chromium source for the Mac version of their browser:\n\n> // A serialization of a position as POD. Not for sharing on disk or sharing\n> // across thread or process boundaries, just for passing a position to an\n> // API that works with positions as opaque objects.\n\nThis submodule allows Lua to represent these as userdata which can be passed in to parameterized attributes for the appliction from which they were retrieved. Examples are expected to be added to the Hammerspoon wiki soon.\n\nAs this submodule utilizes private and undocumented functions in the HIServices framework, if you receive an error using any of these functions or methods indicating an undefined CF function (the function or method will return nil and a string of the format \"CF function AX... undefined\"), please make sure to include the output of the following in any issue you submit to the Hammerspoon github page (enter these into the Hammerspoon console):\n\n hs.inspect(hs.axuielement.axtextmarker._functionCheck())\n hs.inspect(hs.processInfo)\n hs.host.operatingSystemVersionString()",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [
{
"def": "hs.axuielement.observer.notifications[]",
"desc": "A table of common accessibility object notification names, provided for reference.",
"doc": "A table of common accessibility object notification names, provided for reference.\n\nNotes:\n * Notifications are application dependent and can be any string that the application developers choose; this list provides the suggested notification names found within the macOS Framework headers, but the list is not exhaustive nor is an application or element required to provide them.",
"file": "extensions/axuielement/observer.m",
"lineno": "402",
"name": "notifications",
"notes": [
" * Notifications are application dependent and can be any string that the application developers choose; this list provides the suggested notification names found within the macOS Framework headers, but the list is not exhaustive nor is an application or element required to provide them."
],
"signature": "hs.axuielement.observer.notifications[]",
"stripped_doc": "",
"type": "Constant"
}
],
"Constructor": [
{
"def": "hs.axuielement.observer.new(pid) -> observerObject",
"desc": "Creates a new observer object for the application with the specified process ID.",
"doc": "Creates a new observer object for the application with the specified process ID.\n\nParameters:\n * `pid` - the process ID of the application.\n\nReturns:\n * a new observerObject; generates an error if the pid does not exist or if the object cannot be created.\n\nNotes:\n * If you already have the `hs.application` object for an application, you can get its process ID with `hs.application:pid()`\n * If you already have an `hs.axuielement` from the application you wish to observe (it doesn't have to be the application axuielement object, just one belonging to the application), you can get the process ID with `hs.axuielement:pid()`.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "117",
"name": "new",
"notes": [
" * If you already have the `hs.application` object for an application, you can get its process ID with `hs.application:pid()`",
" * If you already have an `hs.axuielement` from the application you wish to observe (it doesn't have to be the application axuielement object, just one belonging to the application), you can get the process ID with `hs.axuielement:pid()`."
],
"parameters": [
" * `pid` - the process ID of the application."
],
"returns": [
" * a new observerObject; generates an error if the pid does not exist or if the object cannot be created."
],
"signature": "hs.axuielement.observer.new(pid) -> observerObject",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "hs.axuielement.observer:addWatcher(element, notification) -> observerObject",
"desc": "Registers the specified notification for the specified accesibility element with the observer.",
"doc": "Registers the specified notification for the specified accesibility element with the observer.\n\nParameters:\n * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.\n * `notification` - a string specifying the notification.\n\nReturns:\n * the observerObject; generates an error if watcher cannot be registered\n\nNotes:\n * multiple notifications for the same accessibility element can be registered by invoking this method multiple times with the same element but different notification strings.\n * if the specified element and notification string are already registered, this method does nothing.\n * the notification string is application dependent and can be any string that the application developers choose; some common ones are found in `hs.axuielement.observer.notifications`, but the list is not exhaustive nor is an application or element required to provide them.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "263",
"name": "addWatcher",
"notes": [
" * multiple notifications for the same accessibility element can be registered by invoking this method multiple times with the same element but different notification strings.",
" * if the specified element and notification string are already registered, this method does nothing.",
" * the notification string is application dependent and can be any string that the application developers choose; some common ones are found in `hs.axuielement.observer.notifications`, but the list is not exhaustive nor is an application or element required to provide them."
],
"parameters": [
" * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.",
" * `notification` - a string specifying the notification."
],
"returns": [
" * the observerObject; generates an error if watcher cannot be registered"
],
"signature": "hs.axuielement.observer:addWatcher(element, notification) -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:callback([fn]) -> observerObject | fn | nil",
"desc": "Get or set the callback for the observer.",
"doc": "Get or set the callback for the observer.\n\nParameters:\n * `fn` - a function, or an explicit nil to remove, specifying the callback function the observer will invoke when the assigned elements generate notifications.\n\nReturns:\n * If an argument is provided, the observerObject; otherwise the current value.\n\nNotes:\n * the callback should expect 4 arguments and return none. The arguments passed to the callback will be as follows:\n * the observerObject itself\n * the `hs.axuielement` object for the accessibility element which generated the notification\n * a string specifying the specific notification which was received\n * a table containing key-value pairs with more information about the notification, if the element and notification type provide it. Commonly this will be an empty table indicating that no additional detail was provided.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "221",
"name": "callback",
"notes": [
" * the callback should expect 4 arguments and return none. The arguments passed to the callback will be as follows:",
" * the observerObject itself",
" * the `hs.axuielement` object for the accessibility element which generated the notification",
" * a string specifying the specific notification which was received",
" * a table containing key-value pairs with more information about the notification, if the element and notification type provide it. Commonly this will be an empty table indicating that no additional detail was provided."
],
"parameters": [
" * `fn` - a function, or an explicit nil to remove, specifying the callback function the observer will invoke when the assigned elements generate notifications."
],
"returns": [
" * If an argument is provided, the observerObject; otherwise the current value."
],
"signature": "hs.axuielement.observer:callback([fn]) -> observerObject | fn | nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:isRunning() -> boolean",
"desc": "Returns true or false indicating whether the observer is currently watching for notifications and generating callbacks.",
"doc": "Returns true or false indicating whether the observer is currently watching for notifications and generating callbacks.\n\nParameters:\n * None\n\nReturns:\n * a boolean value indicating whether or not the observer is currently active.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "202",
"name": "isRunning",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a boolean value indicating whether or not the observer is currently active."
],
"signature": "hs.axuielement.observer:isRunning() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:removeWatcher(element, notification) -> observerObject",
"desc": "Unregisters the specified notification for the specified accessibility element from the observer.",
"doc": "Unregisters the specified notification for the specified accessibility element from the observer.\n\nParameters:\n * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.\n * `notification` - a string specifying the notification.\n\nReturns:\n * the observerObject; generates an error if watcher cannot be unregistered\n\nNotes:\n * if the specified element and notification string are not currently registered with the observer, this method does nothing.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "308",
"name": "removeWatcher",
"notes": [
" * if the specified element and notification string are not currently registered with the observer, this method does nothing."
],
"parameters": [
" * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.",
" * `notification` - a string specifying the notification."
],
"returns": [
" * the observerObject; generates an error if watcher cannot be unregistered"
],
"signature": "hs.axuielement.observer:removeWatcher(element, notification) -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:start() -> observerObject",
"desc": "Start observing the application and trigger callbacks for the elements and notifications assigned.",
"doc": "Start observing the application and trigger callbacks for the elements and notifications assigned.\n\nParameters:\n * None\n\nReturns:\n * the observerObject\n\nNotes:\n * This method does nothing if the observer is already running",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "148",
"name": "start",
"notes": [
" * This method does nothing if the observer is already running"
],
"parameters": [
" * None"
],
"returns": [
" * the observerObject"
],
"signature": "hs.axuielement.observer:start() -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:stop() -> observerObject",
"desc": "Stop observing the application; no further callbacks will be generated.",
"doc": "Stop observing the application; no further callbacks will be generated.\n\nParameters:\n * None\n\nReturns:\n * the observerObject\n\nNotes:\n * This method does nothing if the observer is not currently running",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "175",
"name": "stop",
"notes": [
" * This method does nothing if the observer is not currently running"
],
"parameters": [
" * None"
],
"returns": [
" * the observerObject"
],
"signature": "hs.axuielement.observer:stop() -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:watching([element]) -> table",
"desc": "Returns a table of the notifications currently registered with the observer.",
"doc": "Returns a table of the notifications currently registered with the observer.\n\nParameters:\n * `element` - an optional `hs.axuielement` to return a list of registered notifications for.\n\nReturns:\n * a table containing the currently registered notifications\n\nNotes:\n * If an element is specified, then the table returned will contain a list of strings specifying the specific notifications that the observer is watching that element for.\n * If no argument is specified, then the table will contain key-value pairs in which each key will be an `hs.axuielement` that is being observed and the corresponding value will be a table containing a list of strings specifying the specific notifications that the observer is watching for from from that element.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "348",
"name": "watching",
"notes": [
" * If an element is specified, then the table returned will contain a list of strings specifying the specific notifications that the observer is watching that element for.",
" * If no argument is specified, then the table will contain key-value pairs in which each key will be an `hs.axuielement` that is being observed and the corresponding value will be a table containing a list of strings specifying the specific notifications that the observer is watching for from from that element."
],
"parameters": [
" * `element` - an optional `hs.axuielement` to return a list of registered notifications for."
],
"returns": [
" * a table containing the currently registered notifications"
],
"signature": "hs.axuielement.observer:watching([element]) -> table",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "This submodule allows you to create observers for accessibility elements and be notified when they trigger notifications. Not all notifications are supported by all elements and not all elements support notifications, so some trial and error will be necessary, but for compliant applications, this can allow your code to be notified when an application's user interface changes in some way.",
"doc": "This submodule allows you to create observers for accessibility elements and be notified when they trigger notifications. Not all notifications are supported by all elements and not all elements support notifications, so some trial and error will be necessary, but for compliant applications, this can allow your code to be notified when an application's user interface changes in some way.",
"items": [
{
"def": "hs.axuielement.observer:addWatcher(element, notification) -> observerObject",
"desc": "Registers the specified notification for the specified accesibility element with the observer.",
"doc": "Registers the specified notification for the specified accesibility element with the observer.\n\nParameters:\n * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.\n * `notification` - a string specifying the notification.\n\nReturns:\n * the observerObject; generates an error if watcher cannot be registered\n\nNotes:\n * multiple notifications for the same accessibility element can be registered by invoking this method multiple times with the same element but different notification strings.\n * if the specified element and notification string are already registered, this method does nothing.\n * the notification string is application dependent and can be any string that the application developers choose; some common ones are found in `hs.axuielement.observer.notifications`, but the list is not exhaustive nor is an application or element required to provide them.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "263",
"name": "addWatcher",
"notes": [
" * multiple notifications for the same accessibility element can be registered by invoking this method multiple times with the same element but different notification strings.",
" * if the specified element and notification string are already registered, this method does nothing.",
" * the notification string is application dependent and can be any string that the application developers choose; some common ones are found in `hs.axuielement.observer.notifications`, but the list is not exhaustive nor is an application or element required to provide them."
],
"parameters": [
" * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.",
" * `notification` - a string specifying the notification."
],
"returns": [
" * the observerObject; generates an error if watcher cannot be registered"
],
"signature": "hs.axuielement.observer:addWatcher(element, notification) -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:callback([fn]) -> observerObject | fn | nil",
"desc": "Get or set the callback for the observer.",
"doc": "Get or set the callback for the observer.\n\nParameters:\n * `fn` - a function, or an explicit nil to remove, specifying the callback function the observer will invoke when the assigned elements generate notifications.\n\nReturns:\n * If an argument is provided, the observerObject; otherwise the current value.\n\nNotes:\n * the callback should expect 4 arguments and return none. The arguments passed to the callback will be as follows:\n * the observerObject itself\n * the `hs.axuielement` object for the accessibility element which generated the notification\n * a string specifying the specific notification which was received\n * a table containing key-value pairs with more information about the notification, if the element and notification type provide it. Commonly this will be an empty table indicating that no additional detail was provided.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "221",
"name": "callback",
"notes": [
" * the callback should expect 4 arguments and return none. The arguments passed to the callback will be as follows:",
" * the observerObject itself",
" * the `hs.axuielement` object for the accessibility element which generated the notification",
" * a string specifying the specific notification which was received",
" * a table containing key-value pairs with more information about the notification, if the element and notification type provide it. Commonly this will be an empty table indicating that no additional detail was provided."
],
"parameters": [
" * `fn` - a function, or an explicit nil to remove, specifying the callback function the observer will invoke when the assigned elements generate notifications."
],
"returns": [
" * If an argument is provided, the observerObject; otherwise the current value."
],
"signature": "hs.axuielement.observer:callback([fn]) -> observerObject | fn | nil",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:isRunning() -> boolean",
"desc": "Returns true or false indicating whether the observer is currently watching for notifications and generating callbacks.",
"doc": "Returns true or false indicating whether the observer is currently watching for notifications and generating callbacks.\n\nParameters:\n * None\n\nReturns:\n * a boolean value indicating whether or not the observer is currently active.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "202",
"name": "isRunning",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a boolean value indicating whether or not the observer is currently active."
],
"signature": "hs.axuielement.observer:isRunning() -> boolean",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer.new(pid) -> observerObject",
"desc": "Creates a new observer object for the application with the specified process ID.",
"doc": "Creates a new observer object for the application with the specified process ID.\n\nParameters:\n * `pid` - the process ID of the application.\n\nReturns:\n * a new observerObject; generates an error if the pid does not exist or if the object cannot be created.\n\nNotes:\n * If you already have the `hs.application` object for an application, you can get its process ID with `hs.application:pid()`\n * If you already have an `hs.axuielement` from the application you wish to observe (it doesn't have to be the application axuielement object, just one belonging to the application), you can get the process ID with `hs.axuielement:pid()`.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "117",
"name": "new",
"notes": [
" * If you already have the `hs.application` object for an application, you can get its process ID with `hs.application:pid()`",
" * If you already have an `hs.axuielement` from the application you wish to observe (it doesn't have to be the application axuielement object, just one belonging to the application), you can get the process ID with `hs.axuielement:pid()`."
],
"parameters": [
" * `pid` - the process ID of the application."
],
"returns": [
" * a new observerObject; generates an error if the pid does not exist or if the object cannot be created."
],
"signature": "hs.axuielement.observer.new(pid) -> observerObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.axuielement.observer.notifications[]",
"desc": "A table of common accessibility object notification names, provided for reference.",
"doc": "A table of common accessibility object notification names, provided for reference.\n\nNotes:\n * Notifications are application dependent and can be any string that the application developers choose; this list provides the suggested notification names found within the macOS Framework headers, but the list is not exhaustive nor is an application or element required to provide them.",
"file": "extensions/axuielement/observer.m",
"lineno": "402",
"name": "notifications",
"notes": [
" * Notifications are application dependent and can be any string that the application developers choose; this list provides the suggested notification names found within the macOS Framework headers, but the list is not exhaustive nor is an application or element required to provide them."
],
"signature": "hs.axuielement.observer.notifications[]",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.axuielement.observer:removeWatcher(element, notification) -> observerObject",
"desc": "Unregisters the specified notification for the specified accessibility element from the observer.",
"doc": "Unregisters the specified notification for the specified accessibility element from the observer.\n\nParameters:\n * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.\n * `notification` - a string specifying the notification.\n\nReturns:\n * the observerObject; generates an error if watcher cannot be unregistered\n\nNotes:\n * if the specified element and notification string are not currently registered with the observer, this method does nothing.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "308",
"name": "removeWatcher",
"notes": [
" * if the specified element and notification string are not currently registered with the observer, this method does nothing."
],
"parameters": [
" * `element` - the `hs.axuielement` representing an accessibility element of the application the observer was created for.",
" * `notification` - a string specifying the notification."
],
"returns": [
" * the observerObject; generates an error if watcher cannot be unregistered"
],
"signature": "hs.axuielement.observer:removeWatcher(element, notification) -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:start() -> observerObject",
"desc": "Start observing the application and trigger callbacks for the elements and notifications assigned.",
"doc": "Start observing the application and trigger callbacks for the elements and notifications assigned.\n\nParameters:\n * None\n\nReturns:\n * the observerObject\n\nNotes:\n * This method does nothing if the observer is already running",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "148",
"name": "start",
"notes": [
" * This method does nothing if the observer is already running"
],
"parameters": [
" * None"
],
"returns": [
" * the observerObject"
],
"signature": "hs.axuielement.observer:start() -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:stop() -> observerObject",
"desc": "Stop observing the application; no further callbacks will be generated.",
"doc": "Stop observing the application; no further callbacks will be generated.\n\nParameters:\n * None\n\nReturns:\n * the observerObject\n\nNotes:\n * This method does nothing if the observer is not currently running",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "175",
"name": "stop",
"notes": [
" * This method does nothing if the observer is not currently running"
],
"parameters": [
" * None"
],
"returns": [
" * the observerObject"
],
"signature": "hs.axuielement.observer:stop() -> observerObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.axuielement.observer:watching([element]) -> table",
"desc": "Returns a table of the notifications currently registered with the observer.",
"doc": "Returns a table of the notifications currently registered with the observer.\n\nParameters:\n * `element` - an optional `hs.axuielement` to return a list of registered notifications for.\n\nReturns:\n * a table containing the currently registered notifications\n\nNotes:\n * If an element is specified, then the table returned will contain a list of strings specifying the specific notifications that the observer is watching that element for.\n * If no argument is specified, then the table will contain key-value pairs in which each key will be an `hs.axuielement` that is being observed and the corresponding value will be a table containing a list of strings specifying the specific notifications that the observer is watching for from from that element.",
"examples": [],
"file": "extensions/axuielement/observer.m",
"lineno": "348",
"name": "watching",
"notes": [
" * If an element is specified, then the table returned will contain a list of strings specifying the specific notifications that the observer is watching that element for.",
" * If no argument is specified, then the table will contain key-value pairs in which each key will be an `hs.axuielement` that is being observed and the corresponding value will be a table containing a list of strings specifying the specific notifications that the observer is watching for from from that element."
],
"parameters": [
" * `element` - an optional `hs.axuielement` to return a list of registered notifications for."
],
"returns": [
" * a table containing the currently registered notifications"
],
"signature": "hs.axuielement.observer:watching([element]) -> table",
"stripped_doc": "",
"type": "Method"
}
],
"name": "hs.axuielement.observer",
"stripped_doc": "",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.base64.decode(str) -> val",
"desc": "Decodes a given base64 string",
"doc": "Decodes a given base64 string\n\nParameters:\n * str - A base64 encoded string\n\nReturns:\n * A string containing the decoded data",
"examples": [],
"file": "extensions/base64/base64.lua",
"lineno": "40",
"name": "decode",
"notes": [],
"parameters": [
" * str - A base64 encoded string"
],
"returns": [
" * A string containing the decoded data"
],
"signature": "hs.base64.decode(str) -> val",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.base64.encode(val[,width]) -> str",
"desc": "Encodes a given string to base64",
"doc": "Encodes a given string to base64\n\nParameters:\n * val - A string to encode as base64\n * width - Optional line width to split the string into (usually 64 or 76)\n\nReturns:\n * A string containing the base64 representation of the input string",
"examples": [],
"file": "extensions/base64/base64.lua",
"lineno": "14",
"name": "encode",
"notes": [],
"parameters": [
" * val - A string to encode as base64",
" * width - Optional line width to split the string into (usually 64 or 76)"
],
"returns": [
" * A string containing the base64 representation of the input string"
],
"signature": "hs.base64.encode(val[,width]) -> str",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "Base64 encoding and decoding",
"doc": "Base64 encoding and decoding\n\nPortions sourced from (https://gist.github.com/shpakovski/1902994).",
"items": [
{
"def": "hs.base64.decode(str) -> val",
"desc": "Decodes a given base64 string",
"doc": "Decodes a given base64 string\n\nParameters:\n * str - A base64 encoded string\n\nReturns:\n * A string containing the decoded data",
"examples": [],
"file": "extensions/base64/base64.lua",
"lineno": "40",
"name": "decode",
"notes": [],
"parameters": [
" * str - A base64 encoded string"
],
"returns": [
" * A string containing the decoded data"
],
"signature": "hs.base64.decode(str) -> val",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.base64.encode(val[,width]) -> str",
"desc": "Encodes a given string to base64",
"doc": "Encodes a given string to base64\n\nParameters:\n * val - A string to encode as base64\n * width - Optional line width to split the string into (usually 64 or 76)\n\nReturns:\n * A string containing the base64 representation of the input string",
"examples": [],
"file": "extensions/base64/base64.lua",
"lineno": "14",
"name": "encode",
"notes": [],
"parameters": [
" * val - A string to encode as base64",
" * width - Optional line width to split the string into (usually 64 or 76)"
],
"returns": [
" * A string containing the base64 representation of the input string"
],
"signature": "hs.base64.encode(val[,width]) -> str",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.base64",
"stripped_doc": "\nPortions sourced from (https://gist.github.com/shpakovski/1902994).",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.battery.amperage() -> number",
"desc": "Returns the amount of current flowing through the battery, in mAh",
"doc": "Returns the amount of current flowing through the battery, in mAh\n\nParameters:\n * None\n\nReturns:\n * A number containing the amount of current flowing through the battery. The value may be:\n * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)\n * Zero if the battery is being neither charged nor discharged\n * Greater than zero if the battery is being charged",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "209",
"name": "amperage",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the amount of current flowing through the battery. The value may be:",
" * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)",
" * Zero if the battery is being neither charged nor discharged",
" * Greater than zero if the battery is being charged"
],
"signature": "hs.battery.amperage() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.capacity() -> number",
"desc": "Returns the current capacity of the battery in mAh",
"doc": "Returns the current capacity of the battery in mAh\n\nParameters:\n * None\n\nReturns:\n * A number containing the current capacity of the battery in mAh\n\nNotes:\n * This is the measure of how charged the battery is, vs the value of `hs.battery.maxCapacity()`",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "167",
"name": "capacity",
"notes": [
" * This is the measure of how charged the battery is, vs the value of `hs.battery.maxCapacity()`"
],
"parameters": [
" * None"
],
"returns": [
" * A number containing the current capacity of the battery in mAh"
],
"signature": "hs.battery.capacity() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.cycles() -> number",
"desc": "Returns the number of discharge cycles of the battery",
"doc": "Returns the number of discharge cycles of the battery\n\nParameters:\n * None\n\nReturns:\n * The number of cycles\n\nNotes:\n * One cycle is a full discharge of the battery, followed by a full charge. This may also be an aggregate of many smaller discharge-then-charge cycles (e.g. 10 iterations of discharging the battery from 100% to 90% and then charging back to 100% each time, is considered to be one cycle)",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "122",
"name": "cycles",
"notes": [
" * One cycle is a full discharge of the battery, followed by a full charge. This may also be an aggregate of many smaller discharge-then-charge cycles (e.g. 10 iterations of discharging the battery from 100% to 90% and then charging back to 100% each time, is considered to be one cycle)"
],
"parameters": [
" * None"
],
"returns": [
" * The number of cycles"
],
"signature": "hs.battery.cycles() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.designCapacity() -> number",
"desc": "Returns the design capacity of the battery in mAh.",
"doc": "Returns the design capacity of the battery in mAh.\n\nParameters:\n * None\n\nReturns:\n * A number containing the rated maximum capacity of the battery",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "183",
"name": "designCapacity",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the rated maximum capacity of the battery"
],
"signature": "hs.battery.designCapacity() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.getAll() -> table",
"desc": "Get all available battery information",
"doc": "Get all available battery information\n\nParameters:\n * None\n\nReturns:\n * A table containing all the information provided by the separate functions in hs.battery\n\nNotes:\n * If you require multiple pieces of information about a battery, this function may be more efficient than calling several other functions separately",
"examples": [],
"file": "extensions/battery/battery.lua",
"lineno": "39",
"name": "getAll",
"notes": [
" * If you require multiple pieces of information about a battery, this function may be more efficient than calling several other functions separately"
],
"parameters": [
" * None"
],
"returns": [
" * A table containing all the information provided by the separate functions in hs.battery"
],
"signature": "hs.battery.getAll() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.health() -> string",
"desc": "Returns the health status of the battery.",
"doc": "Returns the health status of the battery.\n\nParameters:\n * None\n\nReturns:\n * A string containing one of {Good, Fair, Poor}, as determined by the Apple Smart Battery controller",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "252",
"name": "health",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing one of {Good, Fair, Poor}, as determined by the Apple Smart Battery controller"
],
"signature": "hs.battery.health() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.healthCondition() -> string or nil",
"desc": "Returns the health condition status of the battery.",
"doc": "Returns the health condition status of the battery.\n\nParameters:\n * None\n\nReturns:\n * Nil if there are no health conditions to report, or a string containing either:\n * \"Check Battery\"\n * \"Permanent Battery Failure\"",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "265",
"name": "healthCondition",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * Nil if there are no health conditions to report, or a string containing either:",
" * \"Check Battery\"",
" * \"Permanent Battery Failure\""
],
"signature": "hs.battery.healthCondition() -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.isCharged() -> boolean",
"desc": "Returns the charged state of the battery",
"doc": "Returns the charged state of the battery\n\nParameters:\n * None\n\nReturns:\n * True if the battery is charged, false if not",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "354",
"name": "isCharged",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the battery is charged, false if not"
],
"signature": "hs.battery.isCharged() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.isCharging() -> boolean",
"desc": "Returns the charging state of the battery",
"doc": "Returns the charging state of the battery\n\nParameters:\n * None\n\nReturns:\n * True if the battery is being charged, false if not",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "341",
"name": "isCharging",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the battery is being charged, false if not"
],
"signature": "hs.battery.isCharging() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.isFinishingCharge() -> boolean or string",
"desc": "Returns true if battery is finishing its charge",
"doc": "Returns true if battery is finishing its charge\n\nParameters:\n * None\n\nReturns:\n * True if the battery is in its final charging state (i.e. trickle charging), false if not, or \"n/a\" if the battery is not charging at all",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "367",
"name": "isFinishingCharge",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the battery is in its final charging state (i.e. trickle charging), false if not, or \"n/a\" if the battery is not charging at all"
],
"signature": "hs.battery.isFinishingCharge() -> boolean or string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.maxCapacity() -> number",
"desc": "Returns the maximum capacity of the battery in mAh",
"doc": "Returns the maximum capacity of the battery in mAh\n\nParameters:\n * None\n\nReturns:\n * A number containing the observed maximum capacity of the battery in mAh\n\nNotes:\n * This may exceed the value of `hs.battery.designCapacity()` due to small variations in the production chemistry vs the design",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "151",
"name": "maxCapacity",
"notes": [
" * This may exceed the value of `hs.battery.designCapacity()` due to small variations in the production chemistry vs the design"
],
"parameters": [
" * None"
],
"returns": [
" * A number containing the observed maximum capacity of the battery in mAh"
],
"signature": "hs.battery.maxCapacity() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.name() -> string",
"desc": "Returns the name of the battery",
"doc": "Returns the name of the battery\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the battery",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "138",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the battery"
],
"signature": "hs.battery.name() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.otherBatteryInfo() -> table",
"desc": "Returns information about non-PSU batteries (e.g. bluetooth accessories)",
"doc": "Returns information about non-PSU batteries (e.g. bluetooth accessories)\n\nParameters:\n * None\n\nReturns:\n * A table containing information about other batteries known to the system, or an empty table if no devices were found",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "450",
"name": "otherBatteryInfo",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about other batteries known to the system, or an empty table if no devices were found"
],
"signature": "hs.battery.otherBatteryInfo() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.percentage() -> number",
"desc": "Returns the current percentage of battery charge",
"doc": "Returns the current percentage of battery charge\n\nParameters:\n * None\n\nReturns:\n * A number containing the percentage of battery charge",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "280",
"name": "percentage",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the percentage of battery charge"
],
"signature": "hs.battery.percentage() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.powerSource() -> string",
"desc": "Returns current source of power",
"doc": "Returns current source of power\n\nParameters:\n * None\n\nReturns:\n * A string containing one of {AC Power, Battery Power, Off Line}.",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "380",
"name": "powerSource",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing one of {AC Power, Battery Power, Off Line}."
],
"signature": "hs.battery.powerSource() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.privateBluetoothBatteryInfo() -> table",
"desc": "Returns information about Bluetooth devices using Apple Private APIs",
"doc": "Returns information about Bluetooth devices using Apple Private APIs\n\nParameters:\n * None\n\nReturns:\n * A table containing information about devices using private Apple APIs.\n\nNotes:\n * This function uses private Apple APIs - that means it can break without notice on any macOS version update. Please report breakage to us!\n * This function will return information for all connected Bluetooth devices, but much of it will be meaningless for most devices\n * The table contains the following keys:\n * vendorID - Numerical identifier for the vendor of the device (Apple's ID is 76)\n * productID - Numerical identifier for the device\n * address - The bluetooth address of the device\n * isApple - A string containing \"YES\" or \"NO\", depending on whether or not this is an Apple/Beats product, or a third party product\n * name - A human readable string containing the name of the device\n * batteryPercentSingle - For some devices this will contain the percentage of the battery (e.g. Beats headphones)\n * batteryPercentCombined - We do not currently understand what this field represents, please report if you find a non-zero value here\n * batteryPercentCase - Battery percentage of AirPods cases (note that this will often read 0 - the AirPod case sleeps aggressively)\n * batteryPercentLeft - Battery percentage of the left AirPod if it is out of the case\n * batteryPercentRight - Battery percentage of the right AirPod if it is out of the case\n * buttonMode - We do not currently understand what this field represents, please report if you find a value other than 1\n * micMode - For AirPods this corresponds to the microphone option in the device's Bluetooth options\n * leftDoubleTap - For AirPods this corresponds to the left double tap action in the device's Bluetooth options\n * rightDoubleTap - For AirPods this corresponds to the right double tap action in the device's Bluetooth options\n * primaryBud - For AirPods this is either \"left\" or \"right\" depending on which bud is currently considered the primary device\n * primaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the primary bud is currently in an ear\n * secondaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the secondary bud is currently in an ear\n * isInEarDetectionSupported - Whether or not this device can detect when it is currently in an ear\n * isEnhancedDoubleTapSupported - Whether or not this device supports double tapping\n * isANCSupported - We believe this likely indicates whether or not this device supports Active Noise Cancelling (e.g. Beats Solo)\n * Please report any crashes from this function - it's likely that there are Bluetooth devices we haven't tested which may return weird data\n * Many/Most/All non-Apple party products will likely return zeros for all of the battery related fields here, as will Apple HID devices. It seems that these private APIs mostly exist to support Apple/Beats headphones.",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "511",
"name": "privateBluetoothBatteryInfo",
"notes": [
" * This function uses private Apple APIs - that means it can break without notice on any macOS version update. Please report breakage to us!",
" * This function will return information for all connected Bluetooth devices, but much of it will be meaningless for most devices",
" * The table contains the following keys:",
" * vendorID - Numerical identifier for the vendor of the device (Apple's ID is 76)",
" * productID - Numerical identifier for the device",
" * address - The bluetooth address of the device",
" * isApple - A string containing \"YES\" or \"NO\", depending on whether or not this is an Apple/Beats product, or a third party product",
" * name - A human readable string containing the name of the device",
" * batteryPercentSingle - For some devices this will contain the percentage of the battery (e.g. Beats headphones)",
" * batteryPercentCombined - We do not currently understand what this field represents, please report if you find a non-zero value here",
" * batteryPercentCase - Battery percentage of AirPods cases (note that this will often read 0 - the AirPod case sleeps aggressively)",
" * batteryPercentLeft - Battery percentage of the left AirPod if it is out of the case",
" * batteryPercentRight - Battery percentage of the right AirPod if it is out of the case",
" * buttonMode - We do not currently understand what this field represents, please report if you find a value other than 1",
" * micMode - For AirPods this corresponds to the microphone option in the device's Bluetooth options",
" * leftDoubleTap - For AirPods this corresponds to the left double tap action in the device's Bluetooth options",
" * rightDoubleTap - For AirPods this corresponds to the right double tap action in the device's Bluetooth options",
" * primaryBud - For AirPods this is either \"left\" or \"right\" depending on which bud is currently considered the primary device",
" * primaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the primary bud is currently in an ear",
" * secondaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the secondary bud is currently in an ear",
" * isInEarDetectionSupported - Whether or not this device can detect when it is currently in an ear",
" * isEnhancedDoubleTapSupported - Whether or not this device supports double tapping",
" * isANCSupported - We believe this likely indicates whether or not this device supports Active Noise Cancelling (e.g. Beats Solo)",
" * Please report any crashes from this function - it's likely that there are Bluetooth devices we haven't tested which may return weird data",
" * Many/Most/All non-Apple party products will likely return zeros for all of the battery related fields here, as will Apple HID devices. It seems that these private APIs mostly exist to support Apple/Beats headphones."
],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about devices using private Apple APIs."
],
"signature": "hs.battery.privateBluetoothBatteryInfo() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.psuSerial() -> integer",
"desc": "Returns the serial number of the attached power supply, if present",
"doc": "Returns the serial number of the attached power supply, if present\n\nParameters:\n * None\n\nReturns:\n * An integer containing the power supply's serial number, or 0 if no serial can be found",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "393",
"name": "psuSerial",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An integer containing the power supply's serial number, or 0 if no serial can be found"
],
"signature": "hs.battery.psuSerial() -> integer",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.psuSerialString() -> string",
"desc": "Returns the serial string of the attached power supply, if present",
"doc": "Returns the serial string of the attached power supply, if present\n\nParameters:\n * None\n\nReturns:\n * A string containing the power supply's serial, or an empty string if no serial can be found",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "418",
"name": "psuSerialString",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the power supply's serial, or an empty string if no serial can be found"
],
"signature": "hs.battery.psuSerialString() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.timeRemaining() -> number",
"desc": "Returns the battery life remaining, in minutes",
"doc": "Returns the battery life remaining, in minutes\n\nParameters:\n * None\n\nReturns:\n * A number containing the minutes of battery life remaining. The value may be:\n * Greater than zero to indicate the number of minutes remaining\n * -1 if the remaining battery life is still being calculated\n * -2 if there is unlimited time remaining (i.e. the system is on AC power)",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "306",
"name": "timeRemaining",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the minutes of battery life remaining. The value may be:",
" * Greater than zero to indicate the number of minutes remaining",
" * -1 if the remaining battery life is still being calculated",
" * -2 if there is unlimited time remaining (i.e. the system is on AC power)"
],
"signature": "hs.battery.timeRemaining() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.timeToFullCharge() -> number",
"desc": "Returns the time remaining for the battery to be fully charged, in minutes",
"doc": "Returns the time remaining for the battery to be fully charged, in minutes\n\nParameters:\n * None\n\nReturns:\n * A number containing the time (in minutes) remaining for the battery to be fully charged, or -1 if the remaining time is still being calculated",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "328",
"name": "timeToFullCharge",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the time (in minutes) remaining for the battery to be fully charged, or -1 if the remaining time is still being calculated"
],
"signature": "hs.battery.timeToFullCharge() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.voltage() -> number",
"desc": "Returns the current voltage of the battery in mV",
"doc": "Returns the current voltage of the battery in mV\n\nParameters:\n * None\n\nReturns:\n * A number containing the current voltage of the battery",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "196",
"name": "voltage",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the current voltage of the battery"
],
"signature": "hs.battery.voltage() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.watts() -> number",
"desc": "Returns the power entering or leaving the battery, in W",
"doc": "Returns the power entering or leaving the battery, in W\n\nParameters:\n * None\n\nReturns:\n * A number containing the rate of energy conversion in the battery. The value may be:\n * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)\n * Zero if the battery is being neither charged nor discharged\n * Greater than zero if the battery is being charged",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "225",
"name": "watts",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the rate of energy conversion in the battery. The value may be:",
" * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)",
" * Zero if the battery is being neither charged nor discharged",
" * Greater than zero if the battery is being charged"
],
"signature": "hs.battery.watts() -> number",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "Battery/power information",
"doc": "Battery/power information\nAll functions here may return nil, if the information requested is not available.\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"items": [
{
"def": "hs.battery.amperage() -> number",
"desc": "Returns the amount of current flowing through the battery, in mAh",
"doc": "Returns the amount of current flowing through the battery, in mAh\n\nParameters:\n * None\n\nReturns:\n * A number containing the amount of current flowing through the battery. The value may be:\n * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)\n * Zero if the battery is being neither charged nor discharged\n * Greater than zero if the battery is being charged",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "209",
"name": "amperage",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the amount of current flowing through the battery. The value may be:",
" * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)",
" * Zero if the battery is being neither charged nor discharged",
" * Greater than zero if the battery is being charged"
],
"signature": "hs.battery.amperage() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.capacity() -> number",
"desc": "Returns the current capacity of the battery in mAh",
"doc": "Returns the current capacity of the battery in mAh\n\nParameters:\n * None\n\nReturns:\n * A number containing the current capacity of the battery in mAh\n\nNotes:\n * This is the measure of how charged the battery is, vs the value of `hs.battery.maxCapacity()`",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "167",
"name": "capacity",
"notes": [
" * This is the measure of how charged the battery is, vs the value of `hs.battery.maxCapacity()`"
],
"parameters": [
" * None"
],
"returns": [
" * A number containing the current capacity of the battery in mAh"
],
"signature": "hs.battery.capacity() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.cycles() -> number",
"desc": "Returns the number of discharge cycles of the battery",
"doc": "Returns the number of discharge cycles of the battery\n\nParameters:\n * None\n\nReturns:\n * The number of cycles\n\nNotes:\n * One cycle is a full discharge of the battery, followed by a full charge. This may also be an aggregate of many smaller discharge-then-charge cycles (e.g. 10 iterations of discharging the battery from 100% to 90% and then charging back to 100% each time, is considered to be one cycle)",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "122",
"name": "cycles",
"notes": [
" * One cycle is a full discharge of the battery, followed by a full charge. This may also be an aggregate of many smaller discharge-then-charge cycles (e.g. 10 iterations of discharging the battery from 100% to 90% and then charging back to 100% each time, is considered to be one cycle)"
],
"parameters": [
" * None"
],
"returns": [
" * The number of cycles"
],
"signature": "hs.battery.cycles() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.designCapacity() -> number",
"desc": "Returns the design capacity of the battery in mAh.",
"doc": "Returns the design capacity of the battery in mAh.\n\nParameters:\n * None\n\nReturns:\n * A number containing the rated maximum capacity of the battery",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "183",
"name": "designCapacity",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the rated maximum capacity of the battery"
],
"signature": "hs.battery.designCapacity() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.getAll() -> table",
"desc": "Get all available battery information",
"doc": "Get all available battery information\n\nParameters:\n * None\n\nReturns:\n * A table containing all the information provided by the separate functions in hs.battery\n\nNotes:\n * If you require multiple pieces of information about a battery, this function may be more efficient than calling several other functions separately",
"examples": [],
"file": "extensions/battery/battery.lua",
"lineno": "39",
"name": "getAll",
"notes": [
" * If you require multiple pieces of information about a battery, this function may be more efficient than calling several other functions separately"
],
"parameters": [
" * None"
],
"returns": [
" * A table containing all the information provided by the separate functions in hs.battery"
],
"signature": "hs.battery.getAll() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.health() -> string",
"desc": "Returns the health status of the battery.",
"doc": "Returns the health status of the battery.\n\nParameters:\n * None\n\nReturns:\n * A string containing one of {Good, Fair, Poor}, as determined by the Apple Smart Battery controller",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "252",
"name": "health",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing one of {Good, Fair, Poor}, as determined by the Apple Smart Battery controller"
],
"signature": "hs.battery.health() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.healthCondition() -> string or nil",
"desc": "Returns the health condition status of the battery.",
"doc": "Returns the health condition status of the battery.\n\nParameters:\n * None\n\nReturns:\n * Nil if there are no health conditions to report, or a string containing either:\n * \"Check Battery\"\n * \"Permanent Battery Failure\"",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "265",
"name": "healthCondition",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * Nil if there are no health conditions to report, or a string containing either:",
" * \"Check Battery\"",
" * \"Permanent Battery Failure\""
],
"signature": "hs.battery.healthCondition() -> string or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.isCharged() -> boolean",
"desc": "Returns the charged state of the battery",
"doc": "Returns the charged state of the battery\n\nParameters:\n * None\n\nReturns:\n * True if the battery is charged, false if not",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "354",
"name": "isCharged",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the battery is charged, false if not"
],
"signature": "hs.battery.isCharged() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.isCharging() -> boolean",
"desc": "Returns the charging state of the battery",
"doc": "Returns the charging state of the battery\n\nParameters:\n * None\n\nReturns:\n * True if the battery is being charged, false if not",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "341",
"name": "isCharging",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the battery is being charged, false if not"
],
"signature": "hs.battery.isCharging() -> boolean",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.isFinishingCharge() -> boolean or string",
"desc": "Returns true if battery is finishing its charge",
"doc": "Returns true if battery is finishing its charge\n\nParameters:\n * None\n\nReturns:\n * True if the battery is in its final charging state (i.e. trickle charging), false if not, or \"n/a\" if the battery is not charging at all",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "367",
"name": "isFinishingCharge",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * True if the battery is in its final charging state (i.e. trickle charging), false if not, or \"n/a\" if the battery is not charging at all"
],
"signature": "hs.battery.isFinishingCharge() -> boolean or string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.maxCapacity() -> number",
"desc": "Returns the maximum capacity of the battery in mAh",
"doc": "Returns the maximum capacity of the battery in mAh\n\nParameters:\n * None\n\nReturns:\n * A number containing the observed maximum capacity of the battery in mAh\n\nNotes:\n * This may exceed the value of `hs.battery.designCapacity()` due to small variations in the production chemistry vs the design",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "151",
"name": "maxCapacity",
"notes": [
" * This may exceed the value of `hs.battery.designCapacity()` due to small variations in the production chemistry vs the design"
],
"parameters": [
" * None"
],
"returns": [
" * A number containing the observed maximum capacity of the battery in mAh"
],
"signature": "hs.battery.maxCapacity() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.name() -> string",
"desc": "Returns the name of the battery",
"doc": "Returns the name of the battery\n\nParameters:\n * None\n\nReturns:\n * A string containing the name of the battery",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "138",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the name of the battery"
],
"signature": "hs.battery.name() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.otherBatteryInfo() -> table",
"desc": "Returns information about non-PSU batteries (e.g. bluetooth accessories)",
"doc": "Returns information about non-PSU batteries (e.g. bluetooth accessories)\n\nParameters:\n * None\n\nReturns:\n * A table containing information about other batteries known to the system, or an empty table if no devices were found",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "450",
"name": "otherBatteryInfo",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about other batteries known to the system, or an empty table if no devices were found"
],
"signature": "hs.battery.otherBatteryInfo() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.percentage() -> number",
"desc": "Returns the current percentage of battery charge",
"doc": "Returns the current percentage of battery charge\n\nParameters:\n * None\n\nReturns:\n * A number containing the percentage of battery charge",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "280",
"name": "percentage",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the percentage of battery charge"
],
"signature": "hs.battery.percentage() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.powerSource() -> string",
"desc": "Returns current source of power",
"doc": "Returns current source of power\n\nParameters:\n * None\n\nReturns:\n * A string containing one of {AC Power, Battery Power, Off Line}.",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "380",
"name": "powerSource",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing one of {AC Power, Battery Power, Off Line}."
],
"signature": "hs.battery.powerSource() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.privateBluetoothBatteryInfo() -> table",
"desc": "Returns information about Bluetooth devices using Apple Private APIs",
"doc": "Returns information about Bluetooth devices using Apple Private APIs\n\nParameters:\n * None\n\nReturns:\n * A table containing information about devices using private Apple APIs.\n\nNotes:\n * This function uses private Apple APIs - that means it can break without notice on any macOS version update. Please report breakage to us!\n * This function will return information for all connected Bluetooth devices, but much of it will be meaningless for most devices\n * The table contains the following keys:\n * vendorID - Numerical identifier for the vendor of the device (Apple's ID is 76)\n * productID - Numerical identifier for the device\n * address - The bluetooth address of the device\n * isApple - A string containing \"YES\" or \"NO\", depending on whether or not this is an Apple/Beats product, or a third party product\n * name - A human readable string containing the name of the device\n * batteryPercentSingle - For some devices this will contain the percentage of the battery (e.g. Beats headphones)\n * batteryPercentCombined - We do not currently understand what this field represents, please report if you find a non-zero value here\n * batteryPercentCase - Battery percentage of AirPods cases (note that this will often read 0 - the AirPod case sleeps aggressively)\n * batteryPercentLeft - Battery percentage of the left AirPod if it is out of the case\n * batteryPercentRight - Battery percentage of the right AirPod if it is out of the case\n * buttonMode - We do not currently understand what this field represents, please report if you find a value other than 1\n * micMode - For AirPods this corresponds to the microphone option in the device's Bluetooth options\n * leftDoubleTap - For AirPods this corresponds to the left double tap action in the device's Bluetooth options\n * rightDoubleTap - For AirPods this corresponds to the right double tap action in the device's Bluetooth options\n * primaryBud - For AirPods this is either \"left\" or \"right\" depending on which bud is currently considered the primary device\n * primaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the primary bud is currently in an ear\n * secondaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the secondary bud is currently in an ear\n * isInEarDetectionSupported - Whether or not this device can detect when it is currently in an ear\n * isEnhancedDoubleTapSupported - Whether or not this device supports double tapping\n * isANCSupported - We believe this likely indicates whether or not this device supports Active Noise Cancelling (e.g. Beats Solo)\n * Please report any crashes from this function - it's likely that there are Bluetooth devices we haven't tested which may return weird data\n * Many/Most/All non-Apple party products will likely return zeros for all of the battery related fields here, as will Apple HID devices. It seems that these private APIs mostly exist to support Apple/Beats headphones.",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "511",
"name": "privateBluetoothBatteryInfo",
"notes": [
" * This function uses private Apple APIs - that means it can break without notice on any macOS version update. Please report breakage to us!",
" * This function will return information for all connected Bluetooth devices, but much of it will be meaningless for most devices",
" * The table contains the following keys:",
" * vendorID - Numerical identifier for the vendor of the device (Apple's ID is 76)",
" * productID - Numerical identifier for the device",
" * address - The bluetooth address of the device",
" * isApple - A string containing \"YES\" or \"NO\", depending on whether or not this is an Apple/Beats product, or a third party product",
" * name - A human readable string containing the name of the device",
" * batteryPercentSingle - For some devices this will contain the percentage of the battery (e.g. Beats headphones)",
" * batteryPercentCombined - We do not currently understand what this field represents, please report if you find a non-zero value here",
" * batteryPercentCase - Battery percentage of AirPods cases (note that this will often read 0 - the AirPod case sleeps aggressively)",
" * batteryPercentLeft - Battery percentage of the left AirPod if it is out of the case",
" * batteryPercentRight - Battery percentage of the right AirPod if it is out of the case",
" * buttonMode - We do not currently understand what this field represents, please report if you find a value other than 1",
" * micMode - For AirPods this corresponds to the microphone option in the device's Bluetooth options",
" * leftDoubleTap - For AirPods this corresponds to the left double tap action in the device's Bluetooth options",
" * rightDoubleTap - For AirPods this corresponds to the right double tap action in the device's Bluetooth options",
" * primaryBud - For AirPods this is either \"left\" or \"right\" depending on which bud is currently considered the primary device",
" * primaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the primary bud is currently in an ear",
" * secondaryInEar - For AirPods this is \"YES\" or \"NO\" depending on whether or not the secondary bud is currently in an ear",
" * isInEarDetectionSupported - Whether or not this device can detect when it is currently in an ear",
" * isEnhancedDoubleTapSupported - Whether or not this device supports double tapping",
" * isANCSupported - We believe this likely indicates whether or not this device supports Active Noise Cancelling (e.g. Beats Solo)",
" * Please report any crashes from this function - it's likely that there are Bluetooth devices we haven't tested which may return weird data",
" * Many/Most/All non-Apple party products will likely return zeros for all of the battery related fields here, as will Apple HID devices. It seems that these private APIs mostly exist to support Apple/Beats headphones."
],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about devices using private Apple APIs."
],
"signature": "hs.battery.privateBluetoothBatteryInfo() -> table",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.psuSerial() -> integer",
"desc": "Returns the serial number of the attached power supply, if present",
"doc": "Returns the serial number of the attached power supply, if present\n\nParameters:\n * None\n\nReturns:\n * An integer containing the power supply's serial number, or 0 if no serial can be found",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "393",
"name": "psuSerial",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * An integer containing the power supply's serial number, or 0 if no serial can be found"
],
"signature": "hs.battery.psuSerial() -> integer",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.psuSerialString() -> string",
"desc": "Returns the serial string of the attached power supply, if present",
"doc": "Returns the serial string of the attached power supply, if present\n\nParameters:\n * None\n\nReturns:\n * A string containing the power supply's serial, or an empty string if no serial can be found",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "418",
"name": "psuSerialString",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A string containing the power supply's serial, or an empty string if no serial can be found"
],
"signature": "hs.battery.psuSerialString() -> string",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.timeRemaining() -> number",
"desc": "Returns the battery life remaining, in minutes",
"doc": "Returns the battery life remaining, in minutes\n\nParameters:\n * None\n\nReturns:\n * A number containing the minutes of battery life remaining. The value may be:\n * Greater than zero to indicate the number of minutes remaining\n * -1 if the remaining battery life is still being calculated\n * -2 if there is unlimited time remaining (i.e. the system is on AC power)",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "306",
"name": "timeRemaining",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the minutes of battery life remaining. The value may be:",
" * Greater than zero to indicate the number of minutes remaining",
" * -1 if the remaining battery life is still being calculated",
" * -2 if there is unlimited time remaining (i.e. the system is on AC power)"
],
"signature": "hs.battery.timeRemaining() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.timeToFullCharge() -> number",
"desc": "Returns the time remaining for the battery to be fully charged, in minutes",
"doc": "Returns the time remaining for the battery to be fully charged, in minutes\n\nParameters:\n * None\n\nReturns:\n * A number containing the time (in minutes) remaining for the battery to be fully charged, or -1 if the remaining time is still being calculated",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "328",
"name": "timeToFullCharge",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the time (in minutes) remaining for the battery to be fully charged, or -1 if the remaining time is still being calculated"
],
"signature": "hs.battery.timeToFullCharge() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.voltage() -> number",
"desc": "Returns the current voltage of the battery in mV",
"doc": "Returns the current voltage of the battery in mV\n\nParameters:\n * None\n\nReturns:\n * A number containing the current voltage of the battery",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "196",
"name": "voltage",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the current voltage of the battery"
],
"signature": "hs.battery.voltage() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.battery.watts() -> number",
"desc": "Returns the power entering or leaving the battery, in W",
"doc": "Returns the power entering or leaving the battery, in W\n\nParameters:\n * None\n\nReturns:\n * A number containing the rate of energy conversion in the battery. The value may be:\n * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)\n * Zero if the battery is being neither charged nor discharged\n * Greater than zero if the battery is being charged",
"examples": [],
"file": "extensions/battery/libbattery.m",
"lineno": "225",
"name": "watts",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the rate of energy conversion in the battery. The value may be:",
" * Less than zero if the battery is being discharged (i.e. the computer is running on battery power)",
" * Zero if the battery is being neither charged nor discharged",
" * Greater than zero if the battery is being charged"
],
"signature": "hs.battery.watts() -> number",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.battery",
"stripped_doc": "All functions here may return nil, if the information requested is not available.\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"submodules": [
"watcher"
],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [
{
"def": "hs.battery.watcher.new(fn) -> watcher",
"desc": "Creates a battery watcher",
"doc": "Creates a battery watcher\n\nParameters:\n * A function that will be called when the battery state changes. The function should accept no arguments.\n\nReturns:\n * An `hs.battery.watcher` object\n\nNotes:\n * Because the callback function accepts no arguments, tracking of state of changing battery attributes is the responsibility of the user (see https://github.com/Hammerspoon/hammerspoon/issues/166 for discussion)",
"examples": [],
"file": "extensions/battery/libbattery_watcher.m",
"lineno": "45",
"name": "new",
"notes": [
" * Because the callback function accepts no arguments, tracking of state of changing battery attributes is the responsibility of the user (see https://github.com/Hammerspoon/hammerspoon/issues/166 for discussion)"
],
"parameters": [
" * A function that will be called when the battery state changes. The function should accept no arguments."
],
"returns": [
" * An `hs.battery.watcher` object"
],
"signature": "hs.battery.watcher.new(fn) -> watcher",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "hs.battery.watcher:start() -> self",
"desc": "Starts the battery watcher",
"doc": "Starts the battery watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.battery.watcher` object",
"examples": [],
"file": "extensions/battery/libbattery_watcher.m",
"lineno": "76",
"name": "start",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.battery.watcher` object"
],
"signature": "hs.battery.watcher:start() -> self",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.battery.watcher:stop() -> self",
"desc": "Stops the battery watcher",
"doc": "Stops the battery watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.battery.watcher` object",
"examples": [],
"file": "extensions/battery/libbattery_watcher.m",
"lineno": "98",
"name": "stop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.battery.watcher` object"
],
"signature": "hs.battery.watcher:stop() -> self",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "Watch for battery/power state changes",
"doc": "Watch for battery/power state changes\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"items": [
{
"def": "hs.battery.watcher.new(fn) -> watcher",
"desc": "Creates a battery watcher",
"doc": "Creates a battery watcher\n\nParameters:\n * A function that will be called when the battery state changes. The function should accept no arguments.\n\nReturns:\n * An `hs.battery.watcher` object\n\nNotes:\n * Because the callback function accepts no arguments, tracking of state of changing battery attributes is the responsibility of the user (see https://github.com/Hammerspoon/hammerspoon/issues/166 for discussion)",
"examples": [],
"file": "extensions/battery/libbattery_watcher.m",
"lineno": "45",
"name": "new",
"notes": [
" * Because the callback function accepts no arguments, tracking of state of changing battery attributes is the responsibility of the user (see https://github.com/Hammerspoon/hammerspoon/issues/166 for discussion)"
],
"parameters": [
" * A function that will be called when the battery state changes. The function should accept no arguments."
],
"returns": [
" * An `hs.battery.watcher` object"
],
"signature": "hs.battery.watcher.new(fn) -> watcher",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.battery.watcher:start() -> self",
"desc": "Starts the battery watcher",
"doc": "Starts the battery watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.battery.watcher` object",
"examples": [],
"file": "extensions/battery/libbattery_watcher.m",
"lineno": "76",
"name": "start",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.battery.watcher` object"
],
"signature": "hs.battery.watcher:start() -> self",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.battery.watcher:stop() -> self",
"desc": "Stops the battery watcher",
"doc": "Stops the battery watcher\n\nParameters:\n * None\n\nReturns:\n * The `hs.battery.watcher` object",
"examples": [],
"file": "extensions/battery/libbattery_watcher.m",
"lineno": "98",
"name": "stop",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * The `hs.battery.watcher` object"
],
"signature": "hs.battery.watcher:stop() -> self",
"stripped_doc": "",
"type": "Method"
}
],
"name": "hs.battery.watcher",
"stripped_doc": "\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [
{
"def": "hs.bonjour.new() -> browserObject",
"desc": "Creates a new network service browser that finds published services on a network using multicast DNS.",
"doc": "Creates a new network service browser that finds published services on a network using multicast DNS.\n\nParameters:\n * None\n\nReturns:\n * a new browserObject or nil if an error occurs",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "138",
"name": "new",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a new browserObject or nil if an error occurs"
],
"signature": "hs.bonjour.new() -> browserObject",
"stripped_doc": "",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.bonjour.machineServices(target, callback) -> none",
"desc": "Polls a host for the service types it is advertising via multicast DNS.",
"doc": "Polls a host for the service types it is advertising via multicast DNS.\n\nParameters:\n * `target` - a string specifying the target host to query for advertised service types\n * `callback` - a callback function which will be invoked when the service type query has completed. The callback should expect one argument which will either be an array of strings specifying the service types the target is advertising or a string specifying the error that occurred.\n\nReturns:\n * None\n\nNotes:\n * this function may not work for all clients implementing multicast DNS; it has been successfully tested with macOS and Linux targets running the Avahi Daemon service, but has generally returned an error when used with minimalist implementations found in common IOT devices and embedded electronics.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "214",
"name": "machineServices",
"notes": [
" * this function may not work for all clients implementing multicast DNS; it has been successfully tested with macOS and Linux targets running the Avahi Daemon service, but has generally returned an error when used with minimalist implementations found in common IOT devices and embedded electronics."
],
"parameters": [
" * `target` - a string specifying the target host to query for advertised service types",
" * `callback` - a callback function which will be invoked when the service type query has completed. The callback should expect one argument which will either be an array of strings specifying the service types the target is advertising or a string specifying the error that occurred."
],
"returns": [
" * None"
],
"signature": "hs.bonjour.machineServices(target, callback) -> none",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.bonjour.networkServices(callback, [timeout]) -> none",
"desc": "Returns a list of service types being advertised on your local network.",
"doc": "Returns a list of service types being advertised on your local network.\n\nParameters:\n * `callback` - a callback function which will be invoked when the services query has completed. The callback should expect one argument: an array of strings specifying the service types discovered on the local network.\n * `timeout` - an optional number, default 5, specifying the maximum number of seconds after the most recently received service type Hammerspoon should wait trying to identify advertised service types before finishing its query and invoking the callback.\n\nReturns:\n * None\n\nNotes:\n * This function is a convienence wrapper to [hs.bonjour:findServices](#findServices) which collects the results from multiple callbacks made to `findServices` and returns them all at once to the callback function provided as an argument to this function.\n\n * Because this function collects the results of multiple callbacks before invoking its own callback, the `timeout` value specified indicates the maximum number of seconds to wait after the latest value received by `findServices` unless the macOS specifies that it believes there are no more service types to identify.\n * This is a best guess made by the macOS which may not always be accurate if your local network is particularly slow or if there are machines on your network which are slow to respond.\n * See [hs.bonjour:findServices](#findServices) for more details if you need to create your own query which can persist for longer periods of time or require termination logic that ignores the macOS's best guess.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "168",
"name": "networkServices",
"notes": [
" * This function is a convienence wrapper to [hs.bonjour:findServices](#findServices) which collects the results from multiple callbacks made to `findServices` and returns them all at once to the callback function provided as an argument to this function.",
"",
" * Because this function collects the results of multiple callbacks before invoking its own callback, the `timeout` value specified indicates the maximum number of seconds to wait after the latest value received by `findServices` unless the macOS specifies that it believes there are no more service types to identify.",
" * This is a best guess made by the macOS which may not always be accurate if your local network is particularly slow or if there are machines on your network which are slow to respond.",
" * See [hs.bonjour:findServices](#findServices) for more details if you need to create your own query which can persist for longer periods of time or require termination logic that ignores the macOS's best guess."
],
"parameters": [
" * `callback` - a callback function which will be invoked when the services query has completed. The callback should expect one argument: an array of strings specifying the service types discovered on the local network.",
" * `timeout` - an optional number, default 5, specifying the maximum number of seconds after the most recently received service type Hammerspoon should wait trying to identify advertised service types before finishing its query and invoking the callback."
],
"returns": [
" * None"
],
"signature": "hs.bonjour.networkServices(callback, [timeout]) -> none",
"stripped_doc": " * Because this function collects the results of multiple callbacks before invoking its own callback, the `timeout` value specified indicates the maximum number of seconds to wait after the latest value received by `findServices` unless the macOS specifies that it believes there are no more service types to identify.\n * This is a best guess made by the macOS which may not always be accurate if your local network is particularly slow or if there are machines on your network which are slow to respond.\n * See [hs.bonjour:findServices](#findServices) for more details if you need to create your own query which can persist for longer periods of time or require termination logic that ignores the macOS's best guess.",
"type": "Function"
}
],
"Method": [
{
"def": "hs.bonjour:findBrowsableDomains(callback) -> browserObject",
"desc": "Return a list of zero-conf and bonjour domains visibile to the users computer.",
"doc": "Return a list of zero-conf and bonjour domains visibile to the users computer.\n\nParameters:\n * `callback` - a function which will be invoked as visible domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error'\n * if `type` == 'domain', the remaining arguments will be:\n * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false)\n * `domain` - a string specifying the name of the domain discovered or removed\n * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not.\n * if `type` == 'error', the remaining arguments will be:\n * `errorString` - a string specifying the error which has occurred\n\nReturns:\n * the browserObject\n\nNotes:\n * This method returns domains which are visible to your machine; however, your machine may or may not be able to access or publish records within the returned domains. See [hs.bonjour:findRegistrationDomains](#findRegistrationDomains)\n\n * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "186",
"name": "findBrowsableDomains",
"notes": [
" * This method returns domains which are visible to your machine; however, your machine may or may not be able to access or publish records within the returned domains. See [hs.bonjour:findRegistrationDomains](#findRegistrationDomains)",
"",
" * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.",
"",
" * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.",
" * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false"
],
"parameters": [
" * `callback` - a function which will be invoked as visible domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error' * if `type` == 'domain', the remaining arguments will be: * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false) * `domain` - a string specifying the name of the domain discovered or removed * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not. * if `type` == 'error', the remaining arguments will be: * `errorString` - a string specifying the error which has occurred"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:findBrowsableDomains(callback) -> browserObject",
"stripped_doc": " * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"type": "Method"
},
{
"def": "hs.bonjour:findRegistrationDomains(callback) -> browserObject",
"desc": "Return a list of zero-conf and bonjour domains this computer can register services in.",
"doc": "Return a list of zero-conf and bonjour domains this computer can register services in.\n\nParameters:\n * `callback` - a function which will be invoked as domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error'\n * if `type` == 'domain', the remaining arguments will be:\n * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false)\n * `domain` - a string specifying the name of the domain discovered or removed\n * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not.\n * if `type` == 'error', the remaining arguments will be:\n * `errorString` - a string specifying the error which has occurred\n\nReturns:\n * the browserObject\n\nNotes:\n * This is the preferred method for accessing domains as it guarantees that the host machine can connect to services in the returned domains. Access to domains outside this list may be more limited. See also [hs.bonjour:findBrowsableDomains](#findBrowsableDomains)\n\n * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "224",
"name": "findRegistrationDomains",
"notes": [
" * This is the preferred method for accessing domains as it guarantees that the host machine can connect to services in the returned domains. Access to domains outside this list may be more limited. See also [hs.bonjour:findBrowsableDomains](#findBrowsableDomains)",
"",
" * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.",
"",
" * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.",
" * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false"
],
"parameters": [
" * `callback` - a function which will be invoked as domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error' * if `type` == 'domain', the remaining arguments will be: * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false) * `domain` - a string specifying the name of the domain discovered or removed * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not. * if `type` == 'error', the remaining arguments will be: * `errorString` - a string specifying the error which has occurred"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:findRegistrationDomains(callback) -> browserObject",
"stripped_doc": " * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"type": "Method"
},
{
"def": "hs.bonjour:findServices(type, [domain], [callback]) -> browserObject",
"desc": "Find advertised services of the type specified.",
"doc": "Find advertised services of the type specified.\n\nParameters:\n * `type` - a string specifying the type of service to discover on your network. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in [hs.bonjour.serviceTypes](#serviceTypes).\n * `domain` - an optional string specifying the domain to look for advertised services in. The domain should end with a period. If you omit this parameter, the default registration domain will be used, usually \"local.\"\n * `callback` - a callback function which will be invoked as service advertisements meeting the specified criteria are discovered. The callback function should expect 2-5 arguments as follows:\n * if a service is discovered or advertising for the service is terminated, the arguments will be:\n * the browserObject\n * the string \"domain\"\n * a boolean indicating whether the service is being advertised (true) or should be removed because advertisments for the service are being terminated (false)\n * the serviceObject for the specific advertisement (see `hs.bonjour.service`)\n * a boolean indicating if more advertisements are expected (true) or if the macOS believes that there are no more advertisements to be discovered (false).\n * if an error occurs, the callback arguments will be:\n * the browserObject\n * the string \"error\"\n * a string specifying the specific error that occurred\n\nReturns:\n * the browserObject\n\nNotes:\n * macOS will indicate when it believes there are no more advertisements of the type specified by `type` in `domain` by marking the last argument to your callback function as false. This is a best guess and may not always be accurate if your network is slow or some servers on your network are particularly slow to respond.\n * In addition, if you leave the browser running this method, you will get future updates when services are removed because of server shutdowns or added because of new servers being booted up.\n * Leaving the browser running does consume some system resources though, so you will have to determine, based upon your specific requirements, if this is a concern for your specific task or not. To terminate the browser when you have rtrieved all of the infomration you reuqire, you can use the [hs.bonjour:stop](#stop) method.\n\n * The special type \"_services._dns-sd._udp.\" can be used to discover the types of services being advertised on your network. The `hs.bonjour.service` objects returned to the callback function cannot actually be resolved, but you can use the `hs.bonjour.service:name` method to create a list of services that are currently present and being advertised.\n * this special type is used by the shortcut function [hs.bonjour.networkServices](#networkServices) for this specific purpose.\n\n * The special domain \"dns-sd.org.\" can be specified to find services advertised through Wide-Area Service Discovery as described at http://www.dns-sd.org. This can be used to discover a limited number of globally available sites on the internet, especially with a service type of `_http._tcp.`.\n * In theory, with additional software, you may be able to publish services on your machine for Wide-Area Service discovery using this domain with `hs.bonjour.service.new` but the local dns server requirements and security implications of doing so are beyond the scope of this documentation. You should refer to http://www.dns-sd.org and your local DNS Server administrator or provider for more details.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "65",
"name": "findServices",
"notes": [
" * macOS will indicate when it believes there are no more advertisements of the type specified by `type` in `domain` by marking the last argument to your callback function as false. This is a best guess and may not always be accurate if your network is slow or some servers on your network are particularly slow to respond.",
" * In addition, if you leave the browser running this method, you will get future updates when services are removed because of server shutdowns or added because of new servers being booted up.",
" * Leaving the browser running does consume some system resources though, so you will have to determine, based upon your specific requirements, if this is a concern for your specific task or not. To terminate the browser when you have rtrieved all of the infomration you reuqire, you can use the [hs.bonjour:stop](#stop) method.",
"",
" * The special type \"_services._dns-sd._udp.\" can be used to discover the types of services being advertised on your network. The `hs.bonjour.service` objects returned to the callback function cannot actually be resolved, but you can use the `hs.bonjour.service:name` method to create a list of services that are currently present and being advertised.",
" * this special type is used by the shortcut function [hs.bonjour.networkServices](#networkServices) for this specific purpose.",
"",
" * The special domain \"dns-sd.org.\" can be specified to find services advertised through Wide-Area Service Discovery as described at http://www.dns-sd.org. This can be used to discover a limited number of globally available sites on the internet, especially with a service type of `_http._tcp.`.",
" * In theory, with additional software, you may be able to publish services on your machine for Wide-Area Service discovery using this domain with `hs.bonjour.service.new` but the local dns server requirements and security implications of doing so are beyond the scope of this documentation. You should refer to http://www.dns-sd.org and your local DNS Server administrator or provider for more details."
],
"parameters": [
" * `type` - a string specifying the type of service to discover on your network. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in [hs.bonjour.serviceTypes](#serviceTypes).",
" * `domain` - an optional string specifying the domain to look for advertised services in. The domain should end with a period. If you omit this parameter, the default registration domain will be used, usually \"local.\"",
" * `callback` - a callback function which will be invoked as service advertisements meeting the specified criteria are discovered. The callback function should expect 2-5 arguments as follows:\n * if a service is discovered or advertising for the service is terminated, the arguments will be: * the browserObject * the string \"domain\" * a boolean indicating whether the service is being advertised (true) or should be removed because advertisments for the service are being terminated (false) * the serviceObject for the specific advertisement (see `hs.bonjour.service`) * a boolean indicating if more advertisements are expected (true) or if the macOS believes that there are no more advertisements to be discovered (false).\n * if an error occurs, the callback arguments will be: * the browserObject * the string \"error\" * a string specifying the specific error that occurred"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:findServices(type, [domain], [callback]) -> browserObject",
"stripped_doc": " * The special type \"_services._dns-sd._udp.\" can be used to discover the types of services being advertised on your network. The `hs.bonjour.service` objects returned to the callback function cannot actually be resolved, but you can use the `hs.bonjour.service:name` method to create a list of services that are currently present and being advertised.\n * this special type is used by the shortcut function [hs.bonjour.networkServices](#networkServices) for this specific purpose.\n * The special domain \"dns-sd.org.\" can be specified to find services advertised through Wide-Area Service Discovery as described at http://www.dns-sd.org. This can be used to discover a limited number of globally available sites on the internet, especially with a service type of `_http._tcp.`.\n * In theory, with additional software, you may be able to publish services on your machine for Wide-Area Service discovery using this domain with `hs.bonjour.service.new` but the local dns server requirements and security implications of doing so are beyond the scope of this documentation. You should refer to http://www.dns-sd.org and your local DNS Server administrator or provider for more details.",
"type": "Method"
},
{
"def": "hs.bonjour:includesPeerToPeer([value]) -> current value | browserObject",
"desc": "Get or set whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available.",
"doc": "Get or set whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nParameters:\n * `value` - an optional boolean, default false, value specifying whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nReturns:\n * if `value` is provided, returns the browserObject; otherwise returns the current value for this property\n\nNotes:\n * This property must be set before initiating a search to have an effect.",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "161",
"name": "includesPeerToPeer",
"notes": [
" * This property must be set before initiating a search to have an effect."
],
"parameters": [
" * `value` - an optional boolean, default false, value specifying whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available."
],
"returns": [
" * if `value` is provided, returns the browserObject; otherwise returns the current value for this property"
],
"signature": "hs.bonjour:includesPeerToPeer([value]) -> current value | browserObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour:stop() -> browserObject",
"desc": "Stops a currently running search or resolution for the browser object",
"doc": "Stops a currently running search or resolution for the browser object\n\nParameters:\n * None\n\nReturns:\n * the browserObject\n\nNotes:\n * This method should be invoked when you have identified the services or hosts you require to reduce the consumption of system resources.\n * Invoking this method on an already idle browser will do nothing\n\n * In general, when your callback function for [hs.bonjour:findBrowsableDomains](#findBrowsableDomains), [hs.bonjour:findRegistrationDomains](#findRegistrationDomains), or [hs.bonjour:findServices](#findServices) receives false for the `moreExpected` paramter, you should invoke this method on the browserObject unless there are specific reasons not to. Possible reasons you might want to extend the life of the browserObject are documented within each method.",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "292",
"name": "stop",
"notes": [
" * This method should be invoked when you have identified the services or hosts you require to reduce the consumption of system resources.",
" * Invoking this method on an already idle browser will do nothing",
"",
" * In general, when your callback function for [hs.bonjour:findBrowsableDomains](#findBrowsableDomains), [hs.bonjour:findRegistrationDomains](#findRegistrationDomains), or [hs.bonjour:findServices](#findServices) receives false for the `moreExpected` paramter, you should invoke this method on the browserObject unless there are specific reasons not to. Possible reasons you might want to extend the life of the browserObject are documented within each method."
],
"parameters": [
" * None"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:stop() -> browserObject",
"stripped_doc": " * In general, when your callback function for [hs.bonjour:findBrowsableDomains](#findBrowsableDomains), [hs.bonjour:findRegistrationDomains](#findRegistrationDomains), or [hs.bonjour:findServices](#findServices) receives false for the `moreExpected` paramter, you should invoke this method on the browserObject unless there are specific reasons not to. Possible reasons you might want to extend the life of the browserObject are documented within each method.",
"type": "Method"
}
],
"Variable": [],
"desc": "Find and publish network services advertised by multicast DNS (Bonjour) with Hammerspoon.",
"doc": "Find and publish network services advertised by multicast DNS (Bonjour) with Hammerspoon.\n\nThis module will allow you to discover services advertised on your network through multicast DNS and publish services offered by your computer.",
"items": [
{
"def": "hs.bonjour:findBrowsableDomains(callback) -> browserObject",
"desc": "Return a list of zero-conf and bonjour domains visibile to the users computer.",
"doc": "Return a list of zero-conf and bonjour domains visibile to the users computer.\n\nParameters:\n * `callback` - a function which will be invoked as visible domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error'\n * if `type` == 'domain', the remaining arguments will be:\n * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false)\n * `domain` - a string specifying the name of the domain discovered or removed\n * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not.\n * if `type` == 'error', the remaining arguments will be:\n * `errorString` - a string specifying the error which has occurred\n\nReturns:\n * the browserObject\n\nNotes:\n * This method returns domains which are visible to your machine; however, your machine may or may not be able to access or publish records within the returned domains. See [hs.bonjour:findRegistrationDomains](#findRegistrationDomains)\n\n * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "186",
"name": "findBrowsableDomains",
"notes": [
" * This method returns domains which are visible to your machine; however, your machine may or may not be able to access or publish records within the returned domains. See [hs.bonjour:findRegistrationDomains](#findRegistrationDomains)",
"",
" * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.",
"",
" * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.",
" * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false"
],
"parameters": [
" * `callback` - a function which will be invoked as visible domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error' * if `type` == 'domain', the remaining arguments will be: * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false) * `domain` - a string specifying the name of the domain discovered or removed * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not. * if `type` == 'error', the remaining arguments will be: * `errorString` - a string specifying the error which has occurred"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:findBrowsableDomains(callback) -> browserObject",
"stripped_doc": " * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"type": "Method"
},
{
"def": "hs.bonjour:findRegistrationDomains(callback) -> browserObject",
"desc": "Return a list of zero-conf and bonjour domains this computer can register services in.",
"doc": "Return a list of zero-conf and bonjour domains this computer can register services in.\n\nParameters:\n * `callback` - a function which will be invoked as domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error'\n * if `type` == 'domain', the remaining arguments will be:\n * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false)\n * `domain` - a string specifying the name of the domain discovered or removed\n * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not.\n * if `type` == 'error', the remaining arguments will be:\n * `errorString` - a string specifying the error which has occurred\n\nReturns:\n * the browserObject\n\nNotes:\n * This is the preferred method for accessing domains as it guarantees that the host machine can connect to services in the returned domains. Access to domains outside this list may be more limited. See also [hs.bonjour:findBrowsableDomains](#findBrowsableDomains)\n\n * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "224",
"name": "findRegistrationDomains",
"notes": [
" * This is the preferred method for accessing domains as it guarantees that the host machine can connect to services in the returned domains. Access to domains outside this list may be more limited. See also [hs.bonjour:findBrowsableDomains](#findBrowsableDomains)",
"",
" * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.",
"",
" * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.",
" * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false"
],
"parameters": [
" * `callback` - a function which will be invoked as domains are discovered. The function should accept the following parameters and return none:\n * `browserObject` - the userdata object for the browserObject which initiated the search\n * `type` - a string which will be 'domain' or 'error' * if `type` == 'domain', the remaining arguments will be: * `added` - a boolean value indicating whether this callback invocation represents a newly discovered or added domain (true) or that the domain has been removed from the network (false) * `domain` - a string specifying the name of the domain discovered or removed * `moreExpected` - a boolean value indicating whether or not the browser expects to discover additional domains or not. * if `type` == 'error', the remaining arguments will be: * `errorString` - a string specifying the error which has occurred"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:findRegistrationDomains(callback) -> browserObject",
"stripped_doc": " * For most non-coporate network users, it is likely that the callback will only be invoked once for the `local` domain. This is normal. Corporate networks or networks including Linux machines using additional domains defined with Avahi may see additional domains as well, though most Avahi installations now use only 'local' by default unless specifically configured to do otherwise.\n * When `moreExpected` becomes false, it is the macOS's best guess as to whether additional records are available.\n * Generally macOS is fairly accurate in this regard concerning domain searchs, so to reduce the impact on system resources, it is recommended that you use [hs.bonjour:stop](#stop) when this parameter is false",
"type": "Method"
},
{
"def": "hs.bonjour:findServices(type, [domain], [callback]) -> browserObject",
"desc": "Find advertised services of the type specified.",
"doc": "Find advertised services of the type specified.\n\nParameters:\n * `type` - a string specifying the type of service to discover on your network. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in [hs.bonjour.serviceTypes](#serviceTypes).\n * `domain` - an optional string specifying the domain to look for advertised services in. The domain should end with a period. If you omit this parameter, the default registration domain will be used, usually \"local.\"\n * `callback` - a callback function which will be invoked as service advertisements meeting the specified criteria are discovered. The callback function should expect 2-5 arguments as follows:\n * if a service is discovered or advertising for the service is terminated, the arguments will be:\n * the browserObject\n * the string \"domain\"\n * a boolean indicating whether the service is being advertised (true) or should be removed because advertisments for the service are being terminated (false)\n * the serviceObject for the specific advertisement (see `hs.bonjour.service`)\n * a boolean indicating if more advertisements are expected (true) or if the macOS believes that there are no more advertisements to be discovered (false).\n * if an error occurs, the callback arguments will be:\n * the browserObject\n * the string \"error\"\n * a string specifying the specific error that occurred\n\nReturns:\n * the browserObject\n\nNotes:\n * macOS will indicate when it believes there are no more advertisements of the type specified by `type` in `domain` by marking the last argument to your callback function as false. This is a best guess and may not always be accurate if your network is slow or some servers on your network are particularly slow to respond.\n * In addition, if you leave the browser running this method, you will get future updates when services are removed because of server shutdowns or added because of new servers being booted up.\n * Leaving the browser running does consume some system resources though, so you will have to determine, based upon your specific requirements, if this is a concern for your specific task or not. To terminate the browser when you have rtrieved all of the infomration you reuqire, you can use the [hs.bonjour:stop](#stop) method.\n\n * The special type \"_services._dns-sd._udp.\" can be used to discover the types of services being advertised on your network. The `hs.bonjour.service` objects returned to the callback function cannot actually be resolved, but you can use the `hs.bonjour.service:name` method to create a list of services that are currently present and being advertised.\n * this special type is used by the shortcut function [hs.bonjour.networkServices](#networkServices) for this specific purpose.\n\n * The special domain \"dns-sd.org.\" can be specified to find services advertised through Wide-Area Service Discovery as described at http://www.dns-sd.org. This can be used to discover a limited number of globally available sites on the internet, especially with a service type of `_http._tcp.`.\n * In theory, with additional software, you may be able to publish services on your machine for Wide-Area Service discovery using this domain with `hs.bonjour.service.new` but the local dns server requirements and security implications of doing so are beyond the scope of this documentation. You should refer to http://www.dns-sd.org and your local DNS Server administrator or provider for more details.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "65",
"name": "findServices",
"notes": [
" * macOS will indicate when it believes there are no more advertisements of the type specified by `type` in `domain` by marking the last argument to your callback function as false. This is a best guess and may not always be accurate if your network is slow or some servers on your network are particularly slow to respond.",
" * In addition, if you leave the browser running this method, you will get future updates when services are removed because of server shutdowns or added because of new servers being booted up.",
" * Leaving the browser running does consume some system resources though, so you will have to determine, based upon your specific requirements, if this is a concern for your specific task or not. To terminate the browser when you have rtrieved all of the infomration you reuqire, you can use the [hs.bonjour:stop](#stop) method.",
"",
" * The special type \"_services._dns-sd._udp.\" can be used to discover the types of services being advertised on your network. The `hs.bonjour.service` objects returned to the callback function cannot actually be resolved, but you can use the `hs.bonjour.service:name` method to create a list of services that are currently present and being advertised.",
" * this special type is used by the shortcut function [hs.bonjour.networkServices](#networkServices) for this specific purpose.",
"",
" * The special domain \"dns-sd.org.\" can be specified to find services advertised through Wide-Area Service Discovery as described at http://www.dns-sd.org. This can be used to discover a limited number of globally available sites on the internet, especially with a service type of `_http._tcp.`.",
" * In theory, with additional software, you may be able to publish services on your machine for Wide-Area Service discovery using this domain with `hs.bonjour.service.new` but the local dns server requirements and security implications of doing so are beyond the scope of this documentation. You should refer to http://www.dns-sd.org and your local DNS Server administrator or provider for more details."
],
"parameters": [
" * `type` - a string specifying the type of service to discover on your network. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in [hs.bonjour.serviceTypes](#serviceTypes).",
" * `domain` - an optional string specifying the domain to look for advertised services in. The domain should end with a period. If you omit this parameter, the default registration domain will be used, usually \"local.\"",
" * `callback` - a callback function which will be invoked as service advertisements meeting the specified criteria are discovered. The callback function should expect 2-5 arguments as follows:\n * if a service is discovered or advertising for the service is terminated, the arguments will be: * the browserObject * the string \"domain\" * a boolean indicating whether the service is being advertised (true) or should be removed because advertisments for the service are being terminated (false) * the serviceObject for the specific advertisement (see `hs.bonjour.service`) * a boolean indicating if more advertisements are expected (true) or if the macOS believes that there are no more advertisements to be discovered (false).\n * if an error occurs, the callback arguments will be: * the browserObject * the string \"error\" * a string specifying the specific error that occurred"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:findServices(type, [domain], [callback]) -> browserObject",
"stripped_doc": " * The special type \"_services._dns-sd._udp.\" can be used to discover the types of services being advertised on your network. The `hs.bonjour.service` objects returned to the callback function cannot actually be resolved, but you can use the `hs.bonjour.service:name` method to create a list of services that are currently present and being advertised.\n * this special type is used by the shortcut function [hs.bonjour.networkServices](#networkServices) for this specific purpose.\n * The special domain \"dns-sd.org.\" can be specified to find services advertised through Wide-Area Service Discovery as described at http://www.dns-sd.org. This can be used to discover a limited number of globally available sites on the internet, especially with a service type of `_http._tcp.`.\n * In theory, with additional software, you may be able to publish services on your machine for Wide-Area Service discovery using this domain with `hs.bonjour.service.new` but the local dns server requirements and security implications of doing so are beyond the scope of this documentation. You should refer to http://www.dns-sd.org and your local DNS Server administrator or provider for more details.",
"type": "Method"
},
{
"def": "hs.bonjour:includesPeerToPeer([value]) -> current value | browserObject",
"desc": "Get or set whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available.",
"doc": "Get or set whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nParameters:\n * `value` - an optional boolean, default false, value specifying whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nReturns:\n * if `value` is provided, returns the browserObject; otherwise returns the current value for this property\n\nNotes:\n * This property must be set before initiating a search to have an effect.",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "161",
"name": "includesPeerToPeer",
"notes": [
" * This property must be set before initiating a search to have an effect."
],
"parameters": [
" * `value` - an optional boolean, default false, value specifying whether to also browse over peer-to-peer Bluetooth and Wi-Fi, if available."
],
"returns": [
" * if `value` is provided, returns the browserObject; otherwise returns the current value for this property"
],
"signature": "hs.bonjour:includesPeerToPeer([value]) -> current value | browserObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.machineServices(target, callback) -> none",
"desc": "Polls a host for the service types it is advertising via multicast DNS.",
"doc": "Polls a host for the service types it is advertising via multicast DNS.\n\nParameters:\n * `target` - a string specifying the target host to query for advertised service types\n * `callback` - a callback function which will be invoked when the service type query has completed. The callback should expect one argument which will either be an array of strings specifying the service types the target is advertising or a string specifying the error that occurred.\n\nReturns:\n * None\n\nNotes:\n * this function may not work for all clients implementing multicast DNS; it has been successfully tested with macOS and Linux targets running the Avahi Daemon service, but has generally returned an error when used with minimalist implementations found in common IOT devices and embedded electronics.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "214",
"name": "machineServices",
"notes": [
" * this function may not work for all clients implementing multicast DNS; it has been successfully tested with macOS and Linux targets running the Avahi Daemon service, but has generally returned an error when used with minimalist implementations found in common IOT devices and embedded electronics."
],
"parameters": [
" * `target` - a string specifying the target host to query for advertised service types",
" * `callback` - a callback function which will be invoked when the service type query has completed. The callback should expect one argument which will either be an array of strings specifying the service types the target is advertising or a string specifying the error that occurred."
],
"returns": [
" * None"
],
"signature": "hs.bonjour.machineServices(target, callback) -> none",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.bonjour.networkServices(callback, [timeout]) -> none",
"desc": "Returns a list of service types being advertised on your local network.",
"doc": "Returns a list of service types being advertised on your local network.\n\nParameters:\n * `callback` - a callback function which will be invoked when the services query has completed. The callback should expect one argument: an array of strings specifying the service types discovered on the local network.\n * `timeout` - an optional number, default 5, specifying the maximum number of seconds after the most recently received service type Hammerspoon should wait trying to identify advertised service types before finishing its query and invoking the callback.\n\nReturns:\n * None\n\nNotes:\n * This function is a convienence wrapper to [hs.bonjour:findServices](#findServices) which collects the results from multiple callbacks made to `findServices` and returns them all at once to the callback function provided as an argument to this function.\n\n * Because this function collects the results of multiple callbacks before invoking its own callback, the `timeout` value specified indicates the maximum number of seconds to wait after the latest value received by `findServices` unless the macOS specifies that it believes there are no more service types to identify.\n * This is a best guess made by the macOS which may not always be accurate if your local network is particularly slow or if there are machines on your network which are slow to respond.\n * See [hs.bonjour:findServices](#findServices) for more details if you need to create your own query which can persist for longer periods of time or require termination logic that ignores the macOS's best guess.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "168",
"name": "networkServices",
"notes": [
" * This function is a convienence wrapper to [hs.bonjour:findServices](#findServices) which collects the results from multiple callbacks made to `findServices` and returns them all at once to the callback function provided as an argument to this function.",
"",
" * Because this function collects the results of multiple callbacks before invoking its own callback, the `timeout` value specified indicates the maximum number of seconds to wait after the latest value received by `findServices` unless the macOS specifies that it believes there are no more service types to identify.",
" * This is a best guess made by the macOS which may not always be accurate if your local network is particularly slow or if there are machines on your network which are slow to respond.",
" * See [hs.bonjour:findServices](#findServices) for more details if you need to create your own query which can persist for longer periods of time or require termination logic that ignores the macOS's best guess."
],
"parameters": [
" * `callback` - a callback function which will be invoked when the services query has completed. The callback should expect one argument: an array of strings specifying the service types discovered on the local network.",
" * `timeout` - an optional number, default 5, specifying the maximum number of seconds after the most recently received service type Hammerspoon should wait trying to identify advertised service types before finishing its query and invoking the callback."
],
"returns": [
" * None"
],
"signature": "hs.bonjour.networkServices(callback, [timeout]) -> none",
"stripped_doc": " * Because this function collects the results of multiple callbacks before invoking its own callback, the `timeout` value specified indicates the maximum number of seconds to wait after the latest value received by `findServices` unless the macOS specifies that it believes there are no more service types to identify.\n * This is a best guess made by the macOS which may not always be accurate if your local network is particularly slow or if there are machines on your network which are slow to respond.\n * See [hs.bonjour:findServices](#findServices) for more details if you need to create your own query which can persist for longer periods of time or require termination logic that ignores the macOS's best guess.",
"type": "Function"
},
{
"def": "hs.bonjour.new() -> browserObject",
"desc": "Creates a new network service browser that finds published services on a network using multicast DNS.",
"doc": "Creates a new network service browser that finds published services on a network using multicast DNS.\n\nParameters:\n * None\n\nReturns:\n * a new browserObject or nil if an error occurs",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "138",
"name": "new",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a new browserObject or nil if an error occurs"
],
"signature": "hs.bonjour.new() -> browserObject",
"stripped_doc": "",
"type": "Constructor"
},
{
"def": "hs.bonjour:stop() -> browserObject",
"desc": "Stops a currently running search or resolution for the browser object",
"doc": "Stops a currently running search or resolution for the browser object\n\nParameters:\n * None\n\nReturns:\n * the browserObject\n\nNotes:\n * This method should be invoked when you have identified the services or hosts you require to reduce the consumption of system resources.\n * Invoking this method on an already idle browser will do nothing\n\n * In general, when your callback function for [hs.bonjour:findBrowsableDomains](#findBrowsableDomains), [hs.bonjour:findRegistrationDomains](#findRegistrationDomains), or [hs.bonjour:findServices](#findServices) receives false for the `moreExpected` paramter, you should invoke this method on the browserObject unless there are specific reasons not to. Possible reasons you might want to extend the life of the browserObject are documented within each method.",
"examples": [],
"file": "extensions/bonjour/libbonjoir.m",
"lineno": "292",
"name": "stop",
"notes": [
" * This method should be invoked when you have identified the services or hosts you require to reduce the consumption of system resources.",
" * Invoking this method on an already idle browser will do nothing",
"",
" * In general, when your callback function for [hs.bonjour:findBrowsableDomains](#findBrowsableDomains), [hs.bonjour:findRegistrationDomains](#findRegistrationDomains), or [hs.bonjour:findServices](#findServices) receives false for the `moreExpected` paramter, you should invoke this method on the browserObject unless there are specific reasons not to. Possible reasons you might want to extend the life of the browserObject are documented within each method."
],
"parameters": [
" * None"
],
"returns": [
" * the browserObject"
],
"signature": "hs.bonjour:stop() -> browserObject",
"stripped_doc": " * In general, when your callback function for [hs.bonjour:findBrowsableDomains](#findBrowsableDomains), [hs.bonjour:findRegistrationDomains](#findRegistrationDomains), or [hs.bonjour:findServices](#findServices) receives false for the `moreExpected` paramter, you should invoke this method on the browserObject unless there are specific reasons not to. Possible reasons you might want to extend the life of the browserObject are documented within each method.",
"type": "Method"
}
],
"name": "hs.bonjour",
"stripped_doc": "\nThis module will allow you to discover services advertised on your network through multicast DNS and publish services offered by your computer.",
"submodules": [
"service"
],
"type": "Module"
},
{
"Command": [],
"Constant": [
{
"def": "hs.bonjour.serviceTypes",
"desc": "A list of common service types which can used for discovery through this module.",
"doc": "A list of common service types which can used for discovery through this module.\n\nNotes:\n * This list was generated from the output of `avahi-browse -b` and `avahi-browse -bk` from the avahi-daemon/stable,now 0.7-4+b1 armhf package under Raspbian GNU/Linux 10.\n * This list is by no means complete and is provided solely for the purposes of providing examples. Additional service types can be discovered quite easily using Google or other search engines.\n * You can view the contents of this table in the Hammerspoon Console by entering `require(\"hs.bonjour\").serviceTypes` into the input field.",
"file": "extensions/bonjour/bonjour.lua",
"lineno": "248",
"name": "serviceTypes",
"notes": [
" * This list was generated from the output of `avahi-browse -b` and `avahi-browse -bk` from the avahi-daemon/stable,now 0.7-4+b1 armhf package under Raspbian GNU/Linux 10.",
" * This list is by no means complete and is provided solely for the purposes of providing examples. Additional service types can be discovered quite easily using Google or other search engines.",
" * You can view the contents of this table in the Hammerspoon Console by entering `require(\"hs.bonjour\").serviceTypes` into the input field."
],
"signature": "hs.bonjour.serviceTypes",
"stripped_doc": "",
"type": "Constant"
}
],
"Constructor": [
{
"def": "hs.bonjour.service.new(name, service, port, [domain]) -> serviceObject",
"desc": "Returns a new serviceObject for advertising a service provided by your computer.",
"doc": "Returns a new serviceObject for advertising a service provided by your computer.\n\nParameters:\n * `name` - The name of the service being advertised. This does not have to be the hostname of the machine. However, if you specify an empty string, the computers hostname will be used.\n * `service` - a string specifying the service being advertised. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.\n * `port` - an integer specifying the tcp or udp port the service is provided at\n * `domain` - an optional string specifying the domain you wish to advertise this service in.\n\nReturns:\n * the newly created service object, or nil if there was an error\n\nNotes:\n * If the name specified is not unique on the network for the service type specified, then a number will be appended to the end of the name. This behavior cannot be overridden and can only be detected by checking [hs.bonjour.service:name](#name) after [hs.bonjour.service:publish](#publish) is invoked to see if the name has been changed from what you originally assigned.\n\n * The service will not be advertised until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n\n * If you do not specify the `domain` paramter, your default domain, usually \"local\" will be used.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "108",
"name": "new",
"notes": [
" * If the name specified is not unique on the network for the service type specified, then a number will be appended to the end of the name. This behavior cannot be overridden and can only be detected by checking [hs.bonjour.service:name](#name) after [hs.bonjour.service:publish](#publish) is invoked to see if the name has been changed from what you originally assigned.",
"",
" * The service will not be advertised until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.",
"",
" * If you do not specify the `domain` paramter, your default domain, usually \"local\" will be used."
],
"parameters": [
" * `name` - The name of the service being advertised. This does not have to be the hostname of the machine. However, if you specify an empty string, the computers hostname will be used.",
" * `service` - a string specifying the service being advertised. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.",
" * `port` - an integer specifying the tcp or udp port the service is provided at",
" * `domain` - an optional string specifying the domain you wish to advertise this service in."
],
"returns": [
" * the newly created service object, or nil if there was an error"
],
"signature": "hs.bonjour.service.new(name, service, port, [domain]) -> serviceObject",
"stripped_doc": " * The service will not be advertised until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n * If you do not specify the `domain` paramter, your default domain, usually \"local\" will be used.",
"type": "Constructor"
},
{
"def": "hs.bonjour.service.remote(name, service, [domain]) -> serviceObject",
"desc": "Returns a new serviceObject for a remote machine (i.e. not the users computer) on your network offering the specified service.",
"doc": "Returns a new serviceObject for a remote machine (i.e. not the users computer) on your network offering the specified service.\n\nParameters:\n * `name` - a string specifying the name of the advertised service on the network to locate. Often, but not always, this will be the hostname of the machine providing the desired service.\n * `service` - a string specifying the service type. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.\n * `domain` - an optional string specifying the domain the service belongs to.\n\nReturns:\n * the newly created service object, or nil if there was an error\n\nNotes:\n * In general you should not need to use this constructor, as they will be created automatically for you in the callbacks to `hs.bonjour:findServices`.\n * This method can be used, however, when you already know that a specific service should exist on the network and you wish to resolve its current IP addresses or text records.\n\n * Resolution of the service ip address, hostname, port, and current text records will not occur until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n\n * The macOS API specifies that an empty domain string (i.e. specifying the `domain` parameter as \"\" or leaving it off completely) should result in using the default domain for the computer; in my experience this results in an error when attempting to resolve the serviceObject's ip addresses if I don't specify \"local\" explicitely. In general this shouldn't be an issue if you limit your use of remote serviceObjects to those returned by `hs.bonjour:findServices` as the domain of discovery will be included in the object for you automatically. If you do try to create these objects independantly yourself, be aware that attempting to use the \"default domain\" rather than specifying it explicitely will probably not work as expected.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "138",
"name": "remote",
"notes": [
" * In general you should not need to use this constructor, as they will be created automatically for you in the callbacks to `hs.bonjour:findServices`.",
" * This method can be used, however, when you already know that a specific service should exist on the network and you wish to resolve its current IP addresses or text records.",
"",
" * Resolution of the service ip address, hostname, port, and current text records will not occur until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.",
"",
" * The macOS API specifies that an empty domain string (i.e. specifying the `domain` parameter as \"\" or leaving it off completely) should result in using the default domain for the computer; in my experience this results in an error when attempting to resolve the serviceObject's ip addresses if I don't specify \"local\" explicitely. In general this shouldn't be an issue if you limit your use of remote serviceObjects to those returned by `hs.bonjour:findServices` as the domain of discovery will be included in the object for you automatically. If you do try to create these objects independantly yourself, be aware that attempting to use the \"default domain\" rather than specifying it explicitely will probably not work as expected."
],
"parameters": [
" * `name` - a string specifying the name of the advertised service on the network to locate. Often, but not always, this will be the hostname of the machine providing the desired service.",
" * `service` - a string specifying the service type. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.",
" * `domain` - an optional string specifying the domain the service belongs to."
],
"returns": [
" * the newly created service object, or nil if there was an error"
],
"signature": "hs.bonjour.service.remote(name, service, [domain]) -> serviceObject",
"stripped_doc": " * Resolution of the service ip address, hostname, port, and current text records will not occur until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n * The macOS API specifies that an empty domain string (i.e. specifying the `domain` parameter as \"\" or leaving it off completely) should result in using the default domain for the computer; in my experience this results in an error when attempting to resolve the serviceObject's ip addresses if I don't specify \"local\" explicitely. In general this shouldn't be an issue if you limit your use of remote serviceObjects to those returned by `hs.bonjour:findServices` as the domain of discovery will be included in the object for you automatically. If you do try to create these objects independantly yourself, be aware that attempting to use the \"default domain\" rather than specifying it explicitely will probably not work as expected.",
"type": "Constructor"
}
],
"Deprecated": [],
"Field": [],
"Function": [],
"Method": [
{
"def": "hs.bonjour.service:addresses() -> table",
"desc": "Returns a table listing the addresses for the service represented by the serviceObject",
"doc": "Returns a table listing the addresses for the service represented by the serviceObject\n\nParameters:\n * None\n\nReturns:\n * an array table of strings representing the IPv4 and IPv6 address of the machine which provides the services represented by the serviceObject\n\nNotes:\n * for remote serviceObjects, the table will be empty if this method is invoked before [hs.bonjour.service:resolve](#resolve).\n * for local (published) serviceObjects, this table will always be empty.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "213",
"name": "addresses",
"notes": [
" * for remote serviceObjects, the table will be empty if this method is invoked before [hs.bonjour.service:resolve](#resolve).",
" * for local (published) serviceObjects, this table will always be empty."
],
"parameters": [
" * None"
],
"returns": [
" * an array table of strings representing the IPv4 and IPv6 address of the machine which provides the services represented by the serviceObject"
],
"signature": "hs.bonjour.service:addresses() -> table",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:domain() -> string",
"desc": "Returns the domain the service represented by the serviceObject belongs to.",
"doc": "Returns the domain the service represented by the serviceObject belongs to.\n\nParameters:\n * None\n\nReturns:\n * a string containing the domain the service represented by the serviceObject belongs to.\n\nNotes:\n * for remote serviceObjects, this domain will be the domain the service was discovered in.\n * for local (published) serviceObjects, this domain will be the domain the service is published in; if you did not specify a domain with [hs.bonjour.service.new](#new) then this will be an empty string until [hs.bonjour.service:publish](#publish) is invoked.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "248",
"name": "domain",
"notes": [
" * for remote serviceObjects, this domain will be the domain the service was discovered in.",
" * for local (published) serviceObjects, this domain will be the domain the service is published in; if you did not specify a domain with [hs.bonjour.service.new](#new) then this will be an empty string until [hs.bonjour.service:publish](#publish) is invoked."
],
"parameters": [
" * None"
],
"returns": [
" * a string containing the domain the service represented by the serviceObject belongs to."
],
"signature": "hs.bonjour.service:domain() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:hostname() -> string",
"desc": "Returns the hostname of the machine the service represented by the serviceObject belongs to.",
"doc": "Returns the hostname of the machine the service represented by the serviceObject belongs to.\n\nParameters:\n * None\n\nReturns:\n * a string containing the hostname of the machine the service represented by the serviceObject belongs to.\n\nNotes:\n * for remote serviceObjects, this will be nil if this method is invoked before [hs.bonjour.service:resolve](#resolve).\n * for local (published) serviceObjects, this method will always return nil.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "286",
"name": "hostname",
"notes": [
" * for remote serviceObjects, this will be nil if this method is invoked before [hs.bonjour.service:resolve](#resolve).",
" * for local (published) serviceObjects, this method will always return nil."
],
"parameters": [
" * None"
],
"returns": [
" * a string containing the hostname of the machine the service represented by the serviceObject belongs to."
],
"signature": "hs.bonjour.service:hostname() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:includesPeerToPeer([value]) -> boolean | serviceObject",
"desc": "Get or set whether the service represented by the service object should be published or resolved over peer-to-peer Bluetooth and Wi-Fi, if available.",
"doc": "Get or set whether the service represented by the service object should be published or resolved over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nParameters:\n * `value` - an optional boolean, default false, specifying whether advertising and resoloving should occur over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nReturns:\n * if `value` is provided, returns the serviceObject; otherwise returns the current value.\n\nNotes:\n * if you are changing the value of this property, you must call this method before invoking [hs.bonjour.service:publish](#publish] or [hs.bonjour.service:resolve](#resolve), or after stopping publishing or resolving with [hs.bonjour.service:stop](#stop).\n\n * for remote serviceObjects, this flag determines if resolution and text record monitoring should occur over peer-to-peer network interfaces.\n * for local (published) serviceObjects, this flag determines if advertising should occur over peer-to-peer network interfaces.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "400",
"name": "includesPeerToPeer",
"notes": [
" * if you are changing the value of this property, you must call this method before invoking [hs.bonjour.service:publish](#publish] or [hs.bonjour.service:resolve](#resolve), or after stopping publishing or resolving with [hs.bonjour.service:stop](#stop).",
"",
" * for remote serviceObjects, this flag determines if resolution and text record monitoring should occur over peer-to-peer network interfaces.",
" * for local (published) serviceObjects, this flag determines if advertising should occur over peer-to-peer network interfaces."
],
"parameters": [
" * `value` - an optional boolean, default false, specifying whether advertising and resoloving should occur over peer-to-peer Bluetooth and Wi-Fi, if available."
],
"returns": [
" * if `value` is provided, returns the serviceObject; otherwise returns the current value."
],
"signature": "hs.bonjour.service:includesPeerToPeer([value]) -> boolean | serviceObject",
"stripped_doc": " * for remote serviceObjects, this flag determines if resolution and text record monitoring should occur over peer-to-peer network interfaces.\n * for local (published) serviceObjects, this flag determines if advertising should occur over peer-to-peer network interfaces.",
"type": "Method"
},
{
"def": "hs.bonjour.service:monitor([callback]) -> serviceObject",
"desc": "Monitor the service for changes to its associated text records.",
"doc": "Monitor the service for changes to its associated text records.\n\nParameters:\n * `callback` - an optional callback function which should expect 3 arguments:\n * the serviceObject userdata\n * the string \"txtRecord\"\n * a table containing key-value pairs specifying the new text records for the service\n\nReturns:\n * the serviceObject\n\nNotes:\n * When monitoring is active, [hs.bonjour.service:txtRecord](#txtRecord) will return the most recent text records observed. If this is the only method by which you check the text records, but you wish to ensure you have the most recent values, you should invoke this method without specifying a callback.\n\n * When [hs.bonjour.service:resolve](#resolve) is invoked, the text records at the time of resolution are captured for retrieval with [hs.bonjour.service:txtRecord](#txtRecord). Subsequent changes to the text records will not be reflected by [hs.bonjour.service:txtRecord](#txtRecord) unless this method has been invoked (with or without a callback function) and is currently active.\n\n * You *can* monitor for text changes on local serviceObjects that were created by [hs.bonjour.service.new](#new) and that you are publishing. This can be used to invoke a callback when one portion of your code makes changes to the text records you are publishing and you need another portion of your code to be aware of this change.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "552",
"name": "monitor",
"notes": [
" * When monitoring is active, [hs.bonjour.service:txtRecord](#txtRecord) will return the most recent text records observed. If this is the only method by which you check the text records, but you wish to ensure you have the most recent values, you should invoke this method without specifying a callback.",
"",
" * When [hs.bonjour.service:resolve](#resolve) is invoked, the text records at the time of resolution are captured for retrieval with [hs.bonjour.service:txtRecord](#txtRecord). Subsequent changes to the text records will not be reflected by [hs.bonjour.service:txtRecord](#txtRecord) unless this method has been invoked (with or without a callback function) and is currently active.",
"",
" * You *can* monitor for text changes on local serviceObjects that were created by [hs.bonjour.service.new](#new) and that you are publishing. This can be used to invoke a callback when one portion of your code makes changes to the text records you are publishing and you need another portion of your code to be aware of this change."
],
"parameters": [
" * `callback` - an optional callback function which should expect 3 arguments:\n * the serviceObject userdata\n * the string \"txtRecord\"\n * a table containing key-value pairs specifying the new text records for the service"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:monitor([callback]) -> serviceObject",
"stripped_doc": " * When [hs.bonjour.service:resolve](#resolve) is invoked, the text records at the time of resolution are captured for retrieval with [hs.bonjour.service:txtRecord](#txtRecord). Subsequent changes to the text records will not be reflected by [hs.bonjour.service:txtRecord](#txtRecord) unless this method has been invoked (with or without a callback function) and is currently active.\n * You *can* monitor for text changes on local serviceObjects that were created by [hs.bonjour.service.new](#new) and that you are publishing. This can be used to invoke a callback when one portion of your code makes changes to the text records you are publishing and you need another portion of your code to be aware of this change.",
"type": "Method"
},
{
"def": "hs.bonjour.service:name() -> string",
"desc": "Returns the name of the service represented by the serviceObject.",
"doc": "Returns the name of the service represented by the serviceObject.\n\nParameters:\n * None\n\nReturns:\n * a string containing the name of the service represented by the serviceObject.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "269",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a string containing the name of the service represented by the serviceObject."
],
"signature": "hs.bonjour.service:name() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:port() -> integer",
"desc": "Returns the port the service represented by the serviceObject is available on.",
"doc": "Returns the port the service represented by the serviceObject is available on.\n\nParameters:\n * None\n\nReturns:\n * a number specifying the port the service represented by the serviceObject is available on.\n\nNotes:\n * for remote serviceObjects, this will be -1 if this method is invoked before [hs.bonjour.service:resolve](#resolve).\n * for local (published) serviceObjects, this method will always return the number specified when the serviceObject was created with the [hs.bonjour.service.new](#new) constructor.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "324",
"name": "port",
"notes": [
" * for remote serviceObjects, this will be -1 if this method is invoked before [hs.bonjour.service:resolve](#resolve).",
" * for local (published) serviceObjects, this method will always return the number specified when the serviceObject was created with the [hs.bonjour.service.new](#new) constructor."
],
"parameters": [
" * None"
],
"returns": [
" * a number specifying the port the service represented by the serviceObject is available on."
],
"signature": "hs.bonjour.service:port() -> integer",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:publish([allowRename], [callback]) -> serviceObject",
"desc": "Begin advertising the specified local service.",
"doc": "Begin advertising the specified local service.\n\nParameters:\n * `allowRename` - an optional boolean, default true, specifying whether to automatically rename the service if the name and type combination is already being published in the service's domain. If renaming is allowed and a conflict occurs, the service name will have `-#` appended to it where `#` is an increasing integer starting at 2.\n * `callback` - an optional callback function which should expect 2 or 3 arguments and return none. The arguments to the callback function will be one of the following sets:\n * on successfull publishing:\n * the serviceObject userdata\n * the string \"published\"\n * if an error occurs during publishing:\n * the serviceObject userdata\n * the string \"error\"\n * a string specifying the specific error that occurred\n\nReturns:\n * the serviceObject\n\nNotes:\n * this method should only be called on serviceObjects which were created with [hs.bonjour.service.new](#new).",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "430",
"name": "publish",
"notes": [
" * this method should only be called on serviceObjects which were created with [hs.bonjour.service.new](#new)."
],
"parameters": [
" * `allowRename` - an optional boolean, default true, specifying whether to automatically rename the service if the name and type combination is already being published in the service's domain. If renaming is allowed and a conflict occurs, the service name will have `-#` appended to it where `#` is an increasing integer starting at 2.",
" * `callback` - an optional callback function which should expect 2 or 3 arguments and return none. The arguments to the callback function will be one of the following sets:\n * on successfull publishing: * the serviceObject userdata * the string \"published\"\n * if an error occurs during publishing: * the serviceObject userdata * the string \"error\" * a string specifying the specific error that occurred"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:publish([allowRename], [callback]) -> serviceObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:resolve([timeout], [callback]) -> serviceObject",
"desc": "Resolve the address and details for a discovered service.",
"doc": "Resolve the address and details for a discovered service.\n\nParameters:\n * `timeout` - an optional number, default 0.0, specifying the maximum number of seconds to attempt to resolve the details for this service. Specifying 0.0 means that the resolution should not timeout and that resolution should continue indefinately.\n * `callback` - an optional callback function which should expect 2 or 3 arguments and return none.\n * on successfull resolution:\n * the serviceObject userdata\n * the string \"resolved\"\n * if an error occurs during resolution:\n * the serviceObject userdata\n * the string \"error\"\n * a string specifying the specific error that occurred\n * if `timeout` is specified and is any number other than 0.0, the following will be sent to the callback when the timeout has been reached:\n * the serviceObject userdata\n * the string \"stop\"\n\nReturns:\n * the serviceObject\n\nNotes:\n * this method should only be called on serviceObjects which were returned by an `hs.bonjour` browserObject or created with [hs.bonjour.service.remote](#remote).\n\n * For a remote service, this method must be called in order to retrieve the [addresses](#addresses), the [port](#port), the [hostname](#hostname), and any the associated [text records](#txtRecord) for the service.\n * To reduce the usage of system resources, you should generally specify a timeout value or make sure to invoke [hs.bonjour.service:stop](#stop) after you have verified that you have received the details you require.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "486",
"name": "resolve",
"notes": [
" * this method should only be called on serviceObjects which were returned by an `hs.bonjour` browserObject or created with [hs.bonjour.service.remote](#remote).",
"",
" * For a remote service, this method must be called in order to retrieve the [addresses](#addresses), the [port](#port), the [hostname](#hostname), and any the associated [text records](#txtRecord) for the service.",
" * To reduce the usage of system resources, you should generally specify a timeout value or make sure to invoke [hs.bonjour.service:stop](#stop) after you have verified that you have received the details you require."
],
"parameters": [
" * `timeout` - an optional number, default 0.0, specifying the maximum number of seconds to attempt to resolve the details for this service. Specifying 0.0 means that the resolution should not timeout and that resolution should continue indefinately.",
" * `callback` - an optional callback function which should expect 2 or 3 arguments and return none.\n * on successfull resolution: * the serviceObject userdata * the string \"resolved\"\n * if an error occurs during resolution: * the serviceObject userdata * the string \"error\" * a string specifying the specific error that occurred\n * if `timeout` is specified and is any number other than 0.0, the following will be sent to the callback when the timeout has been reached: * the serviceObject userdata * the string \"stop\""
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:resolve([timeout], [callback]) -> serviceObject",
"stripped_doc": " * For a remote service, this method must be called in order to retrieve the [addresses](#addresses), the [port](#port), the [hostname](#hostname), and any the associated [text records](#txtRecord) for the service.\n * To reduce the usage of system resources, you should generally specify a timeout value or make sure to invoke [hs.bonjour.service:stop](#stop) after you have verified that you have received the details you require.",
"type": "Method"
},
{
"def": "hs.bonjour.service:stop() -> serviceObject",
"desc": "Stop advertising or resolving the service specified by the serviceObject",
"doc": "Stop advertising or resolving the service specified by the serviceObject\n\nParameters:\n * None\n\nReturns:\n * the serviceObject\n\nNotes:\n * this method will stop the advertising of a service which has been published with [hs.bonjour.service:publish](#publish) or is being resolved with [hs.bonjour.service:resolve](#resolve).\n\n * To reduce the usage of system resources, you should make sure to use this method when resolving a remote service if you did not specify a timeout for [hs.bonjour.service:resolve](#resolve) or specified a timeout of 0.0 once you have verified that you have the details you need.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "588",
"name": "stop",
"notes": [
" * this method will stop the advertising of a service which has been published with [hs.bonjour.service:publish](#publish) or is being resolved with [hs.bonjour.service:resolve](#resolve).",
"",
" * To reduce the usage of system resources, you should make sure to use this method when resolving a remote service if you did not specify a timeout for [hs.bonjour.service:resolve](#resolve) or specified a timeout of 0.0 once you have verified that you have the details you need."
],
"parameters": [
" * None"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:stop() -> serviceObject",
"stripped_doc": " * To reduce the usage of system resources, you should make sure to use this method when resolving a remote service if you did not specify a timeout for [hs.bonjour.service:resolve](#resolve) or specified a timeout of 0.0 once you have verified that you have the details you need.",
"type": "Method"
},
{
"def": "hs.bonjour.service:stopMonitoring() -> serviceObject",
"desc": "Stop monitoring a service for changes to its text records.",
"doc": "Stop monitoring a service for changes to its text records.\n\nParameters:\n * None\n\nReturns:\n * the serviceObject\n\nNotes:\n * This method will stop updating [hs.bonjour.service:txtRecord](#txtRecord) and invoking the callback, if any, assigned with [hs.bonjour.service:monitor](#monitor).",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "612",
"name": "stopMonitoring",
"notes": [
" * This method will stop updating [hs.bonjour.service:txtRecord](#txtRecord) and invoking the callback, if any, assigned with [hs.bonjour.service:monitor](#monitor)."
],
"parameters": [
" * None"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:stopMonitoring() -> serviceObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:txtRecord([records]) -> table | serviceObject | false",
"desc": "Get or set the text records associated with the serviceObject.",
"doc": "Get or set the text records associated with the serviceObject.\n\nParameters:\n * `records` - an optional table specifying the text record for the advertised service as a series of key-value entries. All keys and values must be specified as strings.\n\nReturns:\n * if an argument is provided to this method, returns the serviceObject or false if there was a problem setting the text record for this service. If no argument is provided, returns the current table of text records.\n\nNotes:\n * for remote serviceObjects, this method will return nil if invoked before [hs.bonjour.service:resolve](#resolve)\n * setting the text record for a service replaces the existing records for the serviceObject. If the serviceObject is remote, this change is only visible on the local machine. For a service you are advertising, this change will be advertised to other machines.\n\n * Text records are usually used to provide additional information concerning the service and their purpose and meanings are service dependant; for example, when advertising an `_http._tcp.` service, you can specify a specific path on the server by specifying a table of text records containing the \"path\" key.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "345",
"name": "txtRecord",
"notes": [
" * for remote serviceObjects, this method will return nil if invoked before [hs.bonjour.service:resolve](#resolve)",
" * setting the text record for a service replaces the existing records for the serviceObject. If the serviceObject is remote, this change is only visible on the local machine. For a service you are advertising, this change will be advertised to other machines.",
"",
" * Text records are usually used to provide additional information concerning the service and their purpose and meanings are service dependant; for example, when advertising an `_http._tcp.` service, you can specify a specific path on the server by specifying a table of text records containing the \"path\" key."
],
"parameters": [
" * `records` - an optional table specifying the text record for the advertised service as a series of key-value entries. All keys and values must be specified as strings."
],
"returns": [
" * if an argument is provided to this method, returns the serviceObject or false if there was a problem setting the text record for this service. If no argument is provided, returns the current table of text records."
],
"signature": "hs.bonjour.service:txtRecord([records]) -> table | serviceObject | false",
"stripped_doc": " * Text records are usually used to provide additional information concerning the service and their purpose and meanings are service dependant; for example, when advertising an `_http._tcp.` service, you can specify a specific path on the server by specifying a table of text records containing the \"path\" key.",
"type": "Method"
},
{
"def": "hs.bonjour.service:type() -> string",
"desc": "Returns the type of service represented by the serviceObject.",
"doc": "Returns the type of service represented by the serviceObject.\n\nParameters:\n * None\n\nReturns:\n * a string containing the type of service represented by the serviceObject.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "307",
"name": "type",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a string containing the type of service represented by the serviceObject."
],
"signature": "hs.bonjour.service:type() -> string",
"stripped_doc": "",
"type": "Method"
}
],
"Variable": [],
"desc": "Represents the service records that are discovered or published by the hs.bonjour module.",
"doc": "Represents the service records that are discovered or published by the hs.bonjour module.\n\nThis module allows you to explore the details of discovered services including ip addresses and text records, and to publish your own multicast DNS advertisements for services on your computer. This can be useful to advertise network services provided by other Hammerspoon modules or other applications on your computer which do not publish their own advertisements already.\n\nThis module will *not* allow you to publish proxy records for other hosts on your local network.\nAdditional submodules which may address this limitation as well as provide additional functions available with Apple's dns-sd library are being considered but there is no estimated timeframe at present.",
"items": [
{
"def": "hs.bonjour.service:addresses() -> table",
"desc": "Returns a table listing the addresses for the service represented by the serviceObject",
"doc": "Returns a table listing the addresses for the service represented by the serviceObject\n\nParameters:\n * None\n\nReturns:\n * an array table of strings representing the IPv4 and IPv6 address of the machine which provides the services represented by the serviceObject\n\nNotes:\n * for remote serviceObjects, the table will be empty if this method is invoked before [hs.bonjour.service:resolve](#resolve).\n * for local (published) serviceObjects, this table will always be empty.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "213",
"name": "addresses",
"notes": [
" * for remote serviceObjects, the table will be empty if this method is invoked before [hs.bonjour.service:resolve](#resolve).",
" * for local (published) serviceObjects, this table will always be empty."
],
"parameters": [
" * None"
],
"returns": [
" * an array table of strings representing the IPv4 and IPv6 address of the machine which provides the services represented by the serviceObject"
],
"signature": "hs.bonjour.service:addresses() -> table",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:domain() -> string",
"desc": "Returns the domain the service represented by the serviceObject belongs to.",
"doc": "Returns the domain the service represented by the serviceObject belongs to.\n\nParameters:\n * None\n\nReturns:\n * a string containing the domain the service represented by the serviceObject belongs to.\n\nNotes:\n * for remote serviceObjects, this domain will be the domain the service was discovered in.\n * for local (published) serviceObjects, this domain will be the domain the service is published in; if you did not specify a domain with [hs.bonjour.service.new](#new) then this will be an empty string until [hs.bonjour.service:publish](#publish) is invoked.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "248",
"name": "domain",
"notes": [
" * for remote serviceObjects, this domain will be the domain the service was discovered in.",
" * for local (published) serviceObjects, this domain will be the domain the service is published in; if you did not specify a domain with [hs.bonjour.service.new](#new) then this will be an empty string until [hs.bonjour.service:publish](#publish) is invoked."
],
"parameters": [
" * None"
],
"returns": [
" * a string containing the domain the service represented by the serviceObject belongs to."
],
"signature": "hs.bonjour.service:domain() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:hostname() -> string",
"desc": "Returns the hostname of the machine the service represented by the serviceObject belongs to.",
"doc": "Returns the hostname of the machine the service represented by the serviceObject belongs to.\n\nParameters:\n * None\n\nReturns:\n * a string containing the hostname of the machine the service represented by the serviceObject belongs to.\n\nNotes:\n * for remote serviceObjects, this will be nil if this method is invoked before [hs.bonjour.service:resolve](#resolve).\n * for local (published) serviceObjects, this method will always return nil.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "286",
"name": "hostname",
"notes": [
" * for remote serviceObjects, this will be nil if this method is invoked before [hs.bonjour.service:resolve](#resolve).",
" * for local (published) serviceObjects, this method will always return nil."
],
"parameters": [
" * None"
],
"returns": [
" * a string containing the hostname of the machine the service represented by the serviceObject belongs to."
],
"signature": "hs.bonjour.service:hostname() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:includesPeerToPeer([value]) -> boolean | serviceObject",
"desc": "Get or set whether the service represented by the service object should be published or resolved over peer-to-peer Bluetooth and Wi-Fi, if available.",
"doc": "Get or set whether the service represented by the service object should be published or resolved over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nParameters:\n * `value` - an optional boolean, default false, specifying whether advertising and resoloving should occur over peer-to-peer Bluetooth and Wi-Fi, if available.\n\nReturns:\n * if `value` is provided, returns the serviceObject; otherwise returns the current value.\n\nNotes:\n * if you are changing the value of this property, you must call this method before invoking [hs.bonjour.service:publish](#publish] or [hs.bonjour.service:resolve](#resolve), or after stopping publishing or resolving with [hs.bonjour.service:stop](#stop).\n\n * for remote serviceObjects, this flag determines if resolution and text record monitoring should occur over peer-to-peer network interfaces.\n * for local (published) serviceObjects, this flag determines if advertising should occur over peer-to-peer network interfaces.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "400",
"name": "includesPeerToPeer",
"notes": [
" * if you are changing the value of this property, you must call this method before invoking [hs.bonjour.service:publish](#publish] or [hs.bonjour.service:resolve](#resolve), or after stopping publishing or resolving with [hs.bonjour.service:stop](#stop).",
"",
" * for remote serviceObjects, this flag determines if resolution and text record monitoring should occur over peer-to-peer network interfaces.",
" * for local (published) serviceObjects, this flag determines if advertising should occur over peer-to-peer network interfaces."
],
"parameters": [
" * `value` - an optional boolean, default false, specifying whether advertising and resoloving should occur over peer-to-peer Bluetooth and Wi-Fi, if available."
],
"returns": [
" * if `value` is provided, returns the serviceObject; otherwise returns the current value."
],
"signature": "hs.bonjour.service:includesPeerToPeer([value]) -> boolean | serviceObject",
"stripped_doc": " * for remote serviceObjects, this flag determines if resolution and text record monitoring should occur over peer-to-peer network interfaces.\n * for local (published) serviceObjects, this flag determines if advertising should occur over peer-to-peer network interfaces.",
"type": "Method"
},
{
"def": "hs.bonjour.service:monitor([callback]) -> serviceObject",
"desc": "Monitor the service for changes to its associated text records.",
"doc": "Monitor the service for changes to its associated text records.\n\nParameters:\n * `callback` - an optional callback function which should expect 3 arguments:\n * the serviceObject userdata\n * the string \"txtRecord\"\n * a table containing key-value pairs specifying the new text records for the service\n\nReturns:\n * the serviceObject\n\nNotes:\n * When monitoring is active, [hs.bonjour.service:txtRecord](#txtRecord) will return the most recent text records observed. If this is the only method by which you check the text records, but you wish to ensure you have the most recent values, you should invoke this method without specifying a callback.\n\n * When [hs.bonjour.service:resolve](#resolve) is invoked, the text records at the time of resolution are captured for retrieval with [hs.bonjour.service:txtRecord](#txtRecord). Subsequent changes to the text records will not be reflected by [hs.bonjour.service:txtRecord](#txtRecord) unless this method has been invoked (with or without a callback function) and is currently active.\n\n * You *can* monitor for text changes on local serviceObjects that were created by [hs.bonjour.service.new](#new) and that you are publishing. This can be used to invoke a callback when one portion of your code makes changes to the text records you are publishing and you need another portion of your code to be aware of this change.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "552",
"name": "monitor",
"notes": [
" * When monitoring is active, [hs.bonjour.service:txtRecord](#txtRecord) will return the most recent text records observed. If this is the only method by which you check the text records, but you wish to ensure you have the most recent values, you should invoke this method without specifying a callback.",
"",
" * When [hs.bonjour.service:resolve](#resolve) is invoked, the text records at the time of resolution are captured for retrieval with [hs.bonjour.service:txtRecord](#txtRecord). Subsequent changes to the text records will not be reflected by [hs.bonjour.service:txtRecord](#txtRecord) unless this method has been invoked (with or without a callback function) and is currently active.",
"",
" * You *can* monitor for text changes on local serviceObjects that were created by [hs.bonjour.service.new](#new) and that you are publishing. This can be used to invoke a callback when one portion of your code makes changes to the text records you are publishing and you need another portion of your code to be aware of this change."
],
"parameters": [
" * `callback` - an optional callback function which should expect 3 arguments:\n * the serviceObject userdata\n * the string \"txtRecord\"\n * a table containing key-value pairs specifying the new text records for the service"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:monitor([callback]) -> serviceObject",
"stripped_doc": " * When [hs.bonjour.service:resolve](#resolve) is invoked, the text records at the time of resolution are captured for retrieval with [hs.bonjour.service:txtRecord](#txtRecord). Subsequent changes to the text records will not be reflected by [hs.bonjour.service:txtRecord](#txtRecord) unless this method has been invoked (with or without a callback function) and is currently active.\n * You *can* monitor for text changes on local serviceObjects that were created by [hs.bonjour.service.new](#new) and that you are publishing. This can be used to invoke a callback when one portion of your code makes changes to the text records you are publishing and you need another portion of your code to be aware of this change.",
"type": "Method"
},
{
"def": "hs.bonjour.service:name() -> string",
"desc": "Returns the name of the service represented by the serviceObject.",
"doc": "Returns the name of the service represented by the serviceObject.\n\nParameters:\n * None\n\nReturns:\n * a string containing the name of the service represented by the serviceObject.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "269",
"name": "name",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a string containing the name of the service represented by the serviceObject."
],
"signature": "hs.bonjour.service:name() -> string",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service.new(name, service, port, [domain]) -> serviceObject",
"desc": "Returns a new serviceObject for advertising a service provided by your computer.",
"doc": "Returns a new serviceObject for advertising a service provided by your computer.\n\nParameters:\n * `name` - The name of the service being advertised. This does not have to be the hostname of the machine. However, if you specify an empty string, the computers hostname will be used.\n * `service` - a string specifying the service being advertised. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.\n * `port` - an integer specifying the tcp or udp port the service is provided at\n * `domain` - an optional string specifying the domain you wish to advertise this service in.\n\nReturns:\n * the newly created service object, or nil if there was an error\n\nNotes:\n * If the name specified is not unique on the network for the service type specified, then a number will be appended to the end of the name. This behavior cannot be overridden and can only be detected by checking [hs.bonjour.service:name](#name) after [hs.bonjour.service:publish](#publish) is invoked to see if the name has been changed from what you originally assigned.\n\n * The service will not be advertised until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n\n * If you do not specify the `domain` paramter, your default domain, usually \"local\" will be used.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "108",
"name": "new",
"notes": [
" * If the name specified is not unique on the network for the service type specified, then a number will be appended to the end of the name. This behavior cannot be overridden and can only be detected by checking [hs.bonjour.service:name](#name) after [hs.bonjour.service:publish](#publish) is invoked to see if the name has been changed from what you originally assigned.",
"",
" * The service will not be advertised until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.",
"",
" * If you do not specify the `domain` paramter, your default domain, usually \"local\" will be used."
],
"parameters": [
" * `name` - The name of the service being advertised. This does not have to be the hostname of the machine. However, if you specify an empty string, the computers hostname will be used.",
" * `service` - a string specifying the service being advertised. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.",
" * `port` - an integer specifying the tcp or udp port the service is provided at",
" * `domain` - an optional string specifying the domain you wish to advertise this service in."
],
"returns": [
" * the newly created service object, or nil if there was an error"
],
"signature": "hs.bonjour.service.new(name, service, port, [domain]) -> serviceObject",
"stripped_doc": " * The service will not be advertised until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n * If you do not specify the `domain` paramter, your default domain, usually \"local\" will be used.",
"type": "Constructor"
},
{
"def": "hs.bonjour.service:port() -> integer",
"desc": "Returns the port the service represented by the serviceObject is available on.",
"doc": "Returns the port the service represented by the serviceObject is available on.\n\nParameters:\n * None\n\nReturns:\n * a number specifying the port the service represented by the serviceObject is available on.\n\nNotes:\n * for remote serviceObjects, this will be -1 if this method is invoked before [hs.bonjour.service:resolve](#resolve).\n * for local (published) serviceObjects, this method will always return the number specified when the serviceObject was created with the [hs.bonjour.service.new](#new) constructor.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "324",
"name": "port",
"notes": [
" * for remote serviceObjects, this will be -1 if this method is invoked before [hs.bonjour.service:resolve](#resolve).",
" * for local (published) serviceObjects, this method will always return the number specified when the serviceObject was created with the [hs.bonjour.service.new](#new) constructor."
],
"parameters": [
" * None"
],
"returns": [
" * a number specifying the port the service represented by the serviceObject is available on."
],
"signature": "hs.bonjour.service:port() -> integer",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:publish([allowRename], [callback]) -> serviceObject",
"desc": "Begin advertising the specified local service.",
"doc": "Begin advertising the specified local service.\n\nParameters:\n * `allowRename` - an optional boolean, default true, specifying whether to automatically rename the service if the name and type combination is already being published in the service's domain. If renaming is allowed and a conflict occurs, the service name will have `-#` appended to it where `#` is an increasing integer starting at 2.\n * `callback` - an optional callback function which should expect 2 or 3 arguments and return none. The arguments to the callback function will be one of the following sets:\n * on successfull publishing:\n * the serviceObject userdata\n * the string \"published\"\n * if an error occurs during publishing:\n * the serviceObject userdata\n * the string \"error\"\n * a string specifying the specific error that occurred\n\nReturns:\n * the serviceObject\n\nNotes:\n * this method should only be called on serviceObjects which were created with [hs.bonjour.service.new](#new).",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "430",
"name": "publish",
"notes": [
" * this method should only be called on serviceObjects which were created with [hs.bonjour.service.new](#new)."
],
"parameters": [
" * `allowRename` - an optional boolean, default true, specifying whether to automatically rename the service if the name and type combination is already being published in the service's domain. If renaming is allowed and a conflict occurs, the service name will have `-#` appended to it where `#` is an increasing integer starting at 2.",
" * `callback` - an optional callback function which should expect 2 or 3 arguments and return none. The arguments to the callback function will be one of the following sets:\n * on successfull publishing: * the serviceObject userdata * the string \"published\"\n * if an error occurs during publishing: * the serviceObject userdata * the string \"error\" * a string specifying the specific error that occurred"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:publish([allowRename], [callback]) -> serviceObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service.remote(name, service, [domain]) -> serviceObject",
"desc": "Returns a new serviceObject for a remote machine (i.e. not the users computer) on your network offering the specified service.",
"doc": "Returns a new serviceObject for a remote machine (i.e. not the users computer) on your network offering the specified service.\n\nParameters:\n * `name` - a string specifying the name of the advertised service on the network to locate. Often, but not always, this will be the hostname of the machine providing the desired service.\n * `service` - a string specifying the service type. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.\n * `domain` - an optional string specifying the domain the service belongs to.\n\nReturns:\n * the newly created service object, or nil if there was an error\n\nNotes:\n * In general you should not need to use this constructor, as they will be created automatically for you in the callbacks to `hs.bonjour:findServices`.\n * This method can be used, however, when you already know that a specific service should exist on the network and you wish to resolve its current IP addresses or text records.\n\n * Resolution of the service ip address, hostname, port, and current text records will not occur until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n\n * The macOS API specifies that an empty domain string (i.e. specifying the `domain` parameter as \"\" or leaving it off completely) should result in using the default domain for the computer; in my experience this results in an error when attempting to resolve the serviceObject's ip addresses if I don't specify \"local\" explicitely. In general this shouldn't be an issue if you limit your use of remote serviceObjects to those returned by `hs.bonjour:findServices` as the domain of discovery will be included in the object for you automatically. If you do try to create these objects independantly yourself, be aware that attempting to use the \"default domain\" rather than specifying it explicitely will probably not work as expected.",
"examples": [],
"file": "extensions/bonjour/bonjour.lua",
"lineno": "138",
"name": "remote",
"notes": [
" * In general you should not need to use this constructor, as they will be created automatically for you in the callbacks to `hs.bonjour:findServices`.",
" * This method can be used, however, when you already know that a specific service should exist on the network and you wish to resolve its current IP addresses or text records.",
"",
" * Resolution of the service ip address, hostname, port, and current text records will not occur until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.",
"",
" * The macOS API specifies that an empty domain string (i.e. specifying the `domain` parameter as \"\" or leaving it off completely) should result in using the default domain for the computer; in my experience this results in an error when attempting to resolve the serviceObject's ip addresses if I don't specify \"local\" explicitely. In general this shouldn't be an issue if you limit your use of remote serviceObjects to those returned by `hs.bonjour:findServices` as the domain of discovery will be included in the object for you automatically. If you do try to create these objects independantly yourself, be aware that attempting to use the \"default domain\" rather than specifying it explicitely will probably not work as expected."
],
"parameters": [
" * `name` - a string specifying the name of the advertised service on the network to locate. Often, but not always, this will be the hostname of the machine providing the desired service.",
" * `service` - a string specifying the service type. This string should be specified in the format of '_service._protocol.' where _protocol is one of '_tcp' or '_udp'. Examples of common service types can be found in `hs.bonjour.serviceTypes`.",
" * `domain` - an optional string specifying the domain the service belongs to."
],
"returns": [
" * the newly created service object, or nil if there was an error"
],
"signature": "hs.bonjour.service.remote(name, service, [domain]) -> serviceObject",
"stripped_doc": " * Resolution of the service ip address, hostname, port, and current text records will not occur until [hs.bonjour.service:publish](#publish) is invoked on the serviceObject returned.\n * The macOS API specifies that an empty domain string (i.e. specifying the `domain` parameter as \"\" or leaving it off completely) should result in using the default domain for the computer; in my experience this results in an error when attempting to resolve the serviceObject's ip addresses if I don't specify \"local\" explicitely. In general this shouldn't be an issue if you limit your use of remote serviceObjects to those returned by `hs.bonjour:findServices` as the domain of discovery will be included in the object for you automatically. If you do try to create these objects independantly yourself, be aware that attempting to use the \"default domain\" rather than specifying it explicitely will probably not work as expected.",
"type": "Constructor"
},
{
"def": "hs.bonjour.service:resolve([timeout], [callback]) -> serviceObject",
"desc": "Resolve the address and details for a discovered service.",
"doc": "Resolve the address and details for a discovered service.\n\nParameters:\n * `timeout` - an optional number, default 0.0, specifying the maximum number of seconds to attempt to resolve the details for this service. Specifying 0.0 means that the resolution should not timeout and that resolution should continue indefinately.\n * `callback` - an optional callback function which should expect 2 or 3 arguments and return none.\n * on successfull resolution:\n * the serviceObject userdata\n * the string \"resolved\"\n * if an error occurs during resolution:\n * the serviceObject userdata\n * the string \"error\"\n * a string specifying the specific error that occurred\n * if `timeout` is specified and is any number other than 0.0, the following will be sent to the callback when the timeout has been reached:\n * the serviceObject userdata\n * the string \"stop\"\n\nReturns:\n * the serviceObject\n\nNotes:\n * this method should only be called on serviceObjects which were returned by an `hs.bonjour` browserObject or created with [hs.bonjour.service.remote](#remote).\n\n * For a remote service, this method must be called in order to retrieve the [addresses](#addresses), the [port](#port), the [hostname](#hostname), and any the associated [text records](#txtRecord) for the service.\n * To reduce the usage of system resources, you should generally specify a timeout value or make sure to invoke [hs.bonjour.service:stop](#stop) after you have verified that you have received the details you require.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "486",
"name": "resolve",
"notes": [
" * this method should only be called on serviceObjects which were returned by an `hs.bonjour` browserObject or created with [hs.bonjour.service.remote](#remote).",
"",
" * For a remote service, this method must be called in order to retrieve the [addresses](#addresses), the [port](#port), the [hostname](#hostname), and any the associated [text records](#txtRecord) for the service.",
" * To reduce the usage of system resources, you should generally specify a timeout value or make sure to invoke [hs.bonjour.service:stop](#stop) after you have verified that you have received the details you require."
],
"parameters": [
" * `timeout` - an optional number, default 0.0, specifying the maximum number of seconds to attempt to resolve the details for this service. Specifying 0.0 means that the resolution should not timeout and that resolution should continue indefinately.",
" * `callback` - an optional callback function which should expect 2 or 3 arguments and return none.\n * on successfull resolution: * the serviceObject userdata * the string \"resolved\"\n * if an error occurs during resolution: * the serviceObject userdata * the string \"error\" * a string specifying the specific error that occurred\n * if `timeout` is specified and is any number other than 0.0, the following will be sent to the callback when the timeout has been reached: * the serviceObject userdata * the string \"stop\""
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:resolve([timeout], [callback]) -> serviceObject",
"stripped_doc": " * For a remote service, this method must be called in order to retrieve the [addresses](#addresses), the [port](#port), the [hostname](#hostname), and any the associated [text records](#txtRecord) for the service.\n * To reduce the usage of system resources, you should generally specify a timeout value or make sure to invoke [hs.bonjour.service:stop](#stop) after you have verified that you have received the details you require.",
"type": "Method"
},
{
"def": "hs.bonjour.serviceTypes",
"desc": "A list of common service types which can used for discovery through this module.",
"doc": "A list of common service types which can used for discovery through this module.\n\nNotes:\n * This list was generated from the output of `avahi-browse -b` and `avahi-browse -bk` from the avahi-daemon/stable,now 0.7-4+b1 armhf package under Raspbian GNU/Linux 10.\n * This list is by no means complete and is provided solely for the purposes of providing examples. Additional service types can be discovered quite easily using Google or other search engines.\n * You can view the contents of this table in the Hammerspoon Console by entering `require(\"hs.bonjour\").serviceTypes` into the input field.",
"file": "extensions/bonjour/bonjour.lua",
"lineno": "248",
"name": "serviceTypes",
"notes": [
" * This list was generated from the output of `avahi-browse -b` and `avahi-browse -bk` from the avahi-daemon/stable,now 0.7-4+b1 armhf package under Raspbian GNU/Linux 10.",
" * This list is by no means complete and is provided solely for the purposes of providing examples. Additional service types can be discovered quite easily using Google or other search engines.",
" * You can view the contents of this table in the Hammerspoon Console by entering `require(\"hs.bonjour\").serviceTypes` into the input field."
],
"signature": "hs.bonjour.serviceTypes",
"stripped_doc": "",
"type": "Constant"
},
{
"def": "hs.bonjour.service:stop() -> serviceObject",
"desc": "Stop advertising or resolving the service specified by the serviceObject",
"doc": "Stop advertising or resolving the service specified by the serviceObject\n\nParameters:\n * None\n\nReturns:\n * the serviceObject\n\nNotes:\n * this method will stop the advertising of a service which has been published with [hs.bonjour.service:publish](#publish) or is being resolved with [hs.bonjour.service:resolve](#resolve).\n\n * To reduce the usage of system resources, you should make sure to use this method when resolving a remote service if you did not specify a timeout for [hs.bonjour.service:resolve](#resolve) or specified a timeout of 0.0 once you have verified that you have the details you need.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "588",
"name": "stop",
"notes": [
" * this method will stop the advertising of a service which has been published with [hs.bonjour.service:publish](#publish) or is being resolved with [hs.bonjour.service:resolve](#resolve).",
"",
" * To reduce the usage of system resources, you should make sure to use this method when resolving a remote service if you did not specify a timeout for [hs.bonjour.service:resolve](#resolve) or specified a timeout of 0.0 once you have verified that you have the details you need."
],
"parameters": [
" * None"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:stop() -> serviceObject",
"stripped_doc": " * To reduce the usage of system resources, you should make sure to use this method when resolving a remote service if you did not specify a timeout for [hs.bonjour.service:resolve](#resolve) or specified a timeout of 0.0 once you have verified that you have the details you need.",
"type": "Method"
},
{
"def": "hs.bonjour.service:stopMonitoring() -> serviceObject",
"desc": "Stop monitoring a service for changes to its text records.",
"doc": "Stop monitoring a service for changes to its text records.\n\nParameters:\n * None\n\nReturns:\n * the serviceObject\n\nNotes:\n * This method will stop updating [hs.bonjour.service:txtRecord](#txtRecord) and invoking the callback, if any, assigned with [hs.bonjour.service:monitor](#monitor).",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "612",
"name": "stopMonitoring",
"notes": [
" * This method will stop updating [hs.bonjour.service:txtRecord](#txtRecord) and invoking the callback, if any, assigned with [hs.bonjour.service:monitor](#monitor)."
],
"parameters": [
" * None"
],
"returns": [
" * the serviceObject"
],
"signature": "hs.bonjour.service:stopMonitoring() -> serviceObject",
"stripped_doc": "",
"type": "Method"
},
{
"def": "hs.bonjour.service:txtRecord([records]) -> table | serviceObject | false",
"desc": "Get or set the text records associated with the serviceObject.",
"doc": "Get or set the text records associated with the serviceObject.\n\nParameters:\n * `records` - an optional table specifying the text record for the advertised service as a series of key-value entries. All keys and values must be specified as strings.\n\nReturns:\n * if an argument is provided to this method, returns the serviceObject or false if there was a problem setting the text record for this service. If no argument is provided, returns the current table of text records.\n\nNotes:\n * for remote serviceObjects, this method will return nil if invoked before [hs.bonjour.service:resolve](#resolve)\n * setting the text record for a service replaces the existing records for the serviceObject. If the serviceObject is remote, this change is only visible on the local machine. For a service you are advertising, this change will be advertised to other machines.\n\n * Text records are usually used to provide additional information concerning the service and their purpose and meanings are service dependant; for example, when advertising an `_http._tcp.` service, you can specify a specific path on the server by specifying a table of text records containing the \"path\" key.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "345",
"name": "txtRecord",
"notes": [
" * for remote serviceObjects, this method will return nil if invoked before [hs.bonjour.service:resolve](#resolve)",
" * setting the text record for a service replaces the existing records for the serviceObject. If the serviceObject is remote, this change is only visible on the local machine. For a service you are advertising, this change will be advertised to other machines.",
"",
" * Text records are usually used to provide additional information concerning the service and their purpose and meanings are service dependant; for example, when advertising an `_http._tcp.` service, you can specify a specific path on the server by specifying a table of text records containing the \"path\" key."
],
"parameters": [
" * `records` - an optional table specifying the text record for the advertised service as a series of key-value entries. All keys and values must be specified as strings."
],
"returns": [
" * if an argument is provided to this method, returns the serviceObject or false if there was a problem setting the text record for this service. If no argument is provided, returns the current table of text records."
],
"signature": "hs.bonjour.service:txtRecord([records]) -> table | serviceObject | false",
"stripped_doc": " * Text records are usually used to provide additional information concerning the service and their purpose and meanings are service dependant; for example, when advertising an `_http._tcp.` service, you can specify a specific path on the server by specifying a table of text records containing the \"path\" key.",
"type": "Method"
},
{
"def": "hs.bonjour.service:type() -> string",
"desc": "Returns the type of service represented by the serviceObject.",
"doc": "Returns the type of service represented by the serviceObject.\n\nParameters:\n * None\n\nReturns:\n * a string containing the type of service represented by the serviceObject.",
"examples": [],
"file": "extensions/bonjour/libbonjour_service.m",
"lineno": "307",
"name": "type",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * a string containing the type of service represented by the serviceObject."
],
"signature": "hs.bonjour.service:type() -> string",
"stripped_doc": "",
"type": "Method"
}
],
"name": "hs.bonjour.service",
"stripped_doc": "\nThis module allows you to explore the details of discovered services including ip addresses and text records, and to publish your own multicast DNS advertisements for services on your computer. This can be useful to advertise network services provided by other Hammerspoon modules or other applications on your computer which do not publish their own advertisements already.\n\nThis module will *not* allow you to publish proxy records for other hosts on your local network.\nAdditional submodules which may address this limitation as well as provide additional functions available with Apple's dns-sd library are being considered but there is no estimated timeframe at present.",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.brightness.ambient() -> number",
"desc": "Gets the current ambient brightness",
"doc": "Gets the current ambient brightness\n\nParameters:\n * None\n\nReturns:\n * A number containing the current ambient brightness, measured in lux. If an error occurred, the number will be -1\n\nNotes:\n * Even though external Apple displays include an ambient light sensor, their data is typically not available, so this function will likely only be useful to MacBook users\n\n * On Silicon based macs, this function uses a method similar to that used by `corebrightnessdiag` to retrieve the aggregate lux as reported to `sysdiagnose`.\n * On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value.",
"examples": [],
"file": "extensions/brightness/libbrightness.m",
"lineno": "18",
"name": "ambient",
"notes": [
" * Even though external Apple displays include an ambient light sensor, their data is typically not available, so this function will likely only be useful to MacBook users",
"",
" * On Silicon based macs, this function uses a method similar to that used by `corebrightnessdiag` to retrieve the aggregate lux as reported to `sysdiagnose`.",
" * On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value."
],
"parameters": [
" * None"
],
"returns": [
" * A number containing the current ambient brightness, measured in lux. If an error occurred, the number will be -1"
],
"signature": "hs.brightness.ambient() -> number",
"stripped_doc": " * On Silicon based macs, this function uses a method similar to that used by `corebrightnessdiag` to retrieve the aggregate lux as reported to `sysdiagnose`.\n * On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value.",
"type": "Function"
},
{
"def": "hs.brightness.get() -> number",
"desc": "Returns the current brightness of the display",
"doc": "Returns the current brightness of the display\n\nParameters:\n * None\n\nReturns:\n * A number containing the brightness of the display, between 0 and 100",
"examples": [],
"file": "extensions/brightness/libbrightness.m",
"lineno": "120",
"name": "get",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the brightness of the display, between 0 and 100"
],
"signature": "hs.brightness.get() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.brightness.set(brightness) -> boolean",
"desc": "Sets the display brightness",
"doc": "Sets the display brightness\n\nParameters:\n * brightness - A number between 0 and 100\n\nReturns:\n * True if the brightness was set, false if not",
"examples": [],
"file": "extensions/brightness/libbrightness.m",
"lineno": "82",
"name": "set",
"notes": [],
"parameters": [
" * brightness - A number between 0 and 100"
],
"returns": [
" * True if the brightness was set, false if not"
],
"signature": "hs.brightness.set(brightness) -> boolean",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "Inspect/manipulate display brightness",
"doc": "Inspect/manipulate display brightness\n\nHome: https://github.com/asmagill/mjolnir_asm.sys\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"items": [
{
"def": "hs.brightness.ambient() -> number",
"desc": "Gets the current ambient brightness",
"doc": "Gets the current ambient brightness\n\nParameters:\n * None\n\nReturns:\n * A number containing the current ambient brightness, measured in lux. If an error occurred, the number will be -1\n\nNotes:\n * Even though external Apple displays include an ambient light sensor, their data is typically not available, so this function will likely only be useful to MacBook users\n\n * On Silicon based macs, this function uses a method similar to that used by `corebrightnessdiag` to retrieve the aggregate lux as reported to `sysdiagnose`.\n * On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value.",
"examples": [],
"file": "extensions/brightness/libbrightness.m",
"lineno": "18",
"name": "ambient",
"notes": [
" * Even though external Apple displays include an ambient light sensor, their data is typically not available, so this function will likely only be useful to MacBook users",
"",
" * On Silicon based macs, this function uses a method similar to that used by `corebrightnessdiag` to retrieve the aggregate lux as reported to `sysdiagnose`.",
" * On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value."
],
"parameters": [
" * None"
],
"returns": [
" * A number containing the current ambient brightness, measured in lux. If an error occurred, the number will be -1"
],
"signature": "hs.brightness.ambient() -> number",
"stripped_doc": " * On Silicon based macs, this function uses a method similar to that used by `corebrightnessdiag` to retrieve the aggregate lux as reported to `sysdiagnose`.\n * On Intel based macs, the raw sensor data is converted to lux via an algorithm used by Mozilla Firefox and is not guaranteed to give an accurate lux value.",
"type": "Function"
},
{
"def": "hs.brightness.get() -> number",
"desc": "Returns the current brightness of the display",
"doc": "Returns the current brightness of the display\n\nParameters:\n * None\n\nReturns:\n * A number containing the brightness of the display, between 0 and 100",
"examples": [],
"file": "extensions/brightness/libbrightness.m",
"lineno": "120",
"name": "get",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A number containing the brightness of the display, between 0 and 100"
],
"signature": "hs.brightness.get() -> number",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.brightness.set(brightness) -> boolean",
"desc": "Sets the display brightness",
"doc": "Sets the display brightness\n\nParameters:\n * brightness - A number between 0 and 100\n\nReturns:\n * True if the brightness was set, false if not",
"examples": [],
"file": "extensions/brightness/libbrightness.m",
"lineno": "82",
"name": "set",
"notes": [],
"parameters": [
" * brightness - A number between 0 and 100"
],
"returns": [
" * True if the brightness was set, false if not"
],
"signature": "hs.brightness.set(brightness) -> boolean",
"stripped_doc": "",
"type": "Function"
}
],
"name": "hs.brightness",
"stripped_doc": "\nHome: https://github.com/asmagill/mjolnir_asm.sys\n\nThis module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).",
"submodules": [],
"type": "Module"
},
{
"Command": [],
"Constant": [],
"Constructor": [],
"Deprecated": [],
"Field": [],
"Function": [
{
"def": "hs.caffeinate.currentAssertions()",
"desc": "Fetches information about processes which are currently asserting display/power sleep restrictions",
"doc": "Fetches information about processes which are currently asserting display/power sleep restrictions\n\nParameters:\n * None\n\nReturns:\n * A table containing information about current power assertions, with process IDs (PID) as the keys, each of which may contain multiple assertions",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "296",
"name": "currentAssertions",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about current power assertions, with process IDs (PID) as the keys, each of which may contain multiple assertions"
],
"signature": "hs.caffeinate.currentAssertions()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.declareUserActivity([id])",
"desc": "Informs the OS that the user performed some activity",
"doc": "Informs the OS that the user performed some activity\n\nParameters:\n * id - An option number containing the assertion ID returned by a previous call of this function\n\nReturns:\n * A number containing the ID of the assertion generated by this function\n\nNotes:\n * This is intended to simulate user activity, for example to prevent displays from sleeping, or to wake them up\n * It is not mandatory to re-use assertion IDs if you are calling this function mulitple times, but it is recommended that you do so if the calls are related",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "209",
"name": "declareUserActivity",
"notes": [
" * This is intended to simulate user activity, for example to prevent displays from sleeping, or to wake them up",
" * It is not mandatory to re-use assertion IDs if you are calling this function mulitple times, but it is recommended that you do so if the calls are related"
],
"parameters": [
" * id - An option number containing the assertion ID returned by a previous call of this function"
],
"returns": [
" * A number containing the ID of the assertion generated by this function"
],
"signature": "hs.caffeinate.declareUserActivity([id])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.fastUserSwitch()",
"desc": "Show the Fast User Switch screen (ie a login screen without logging out first)",
"doc": "Show the Fast User Switch screen (ie a login screen without logging out first)\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "109",
"name": "fastUserSwitch",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.fastUserSwitch()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.get(sleepType) -> bool or nil",
"desc": "Queries whether a particular sleep type is being prevented",
"doc": "Queries whether a particular sleep type is being prevented\n\nParameters:\n * sleepType - A string containing the type of sleep to inspect (see [hs.caffeinate.set()](#set) for information about the possible values)\n\nReturns:\n * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "55",
"name": "get",
"notes": [],
"parameters": [
" * sleepType - A string containing the type of sleep to inspect (see [hs.caffeinate.set()](#set) for information about the possible values)"
],
"returns": [
" * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value"
],
"signature": "hs.caffeinate.get(sleepType) -> bool or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.lockScreen()",
"desc": "Locks the displays",
"doc": "Locks the displays\n\nParameters:\n * None\n\nReturns:\n * None\n\nNotes:\n * This function uses private Apple APIs and could therefore stop working in any given release of macOS without warning.",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "237",
"name": "lockScreen",
"notes": [
" * This function uses private Apple APIs and could therefore stop working in any given release of macOS without warning."
],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.lockScreen()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.logOut()",
"desc": "Request the system log out the current user",
"doc": "Request the system log out the current user\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "135",
"name": "logOut",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.logOut()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.restartSystem()",
"desc": "Request the system reboot",
"doc": "Request the system reboot\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "148",
"name": "restartSystem",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.restartSystem()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.sessionProperties()",
"desc": "Fetches information from the display server about the current session",
"doc": "Fetches information from the display server about the current session\n\nParameters:\n * None\n\nReturns:\n * A table containing information about the current session, or nil if an error occurred\n\nNotes:\n * The keys in this dictionary will vary based on the current state of the system (e.g. local vs VNC login, screen locked vs unlocked).",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "271",
"name": "sessionProperties",
"notes": [
" * The keys in this dictionary will vary based on the current state of the system (e.g. local vs VNC login, screen locked vs unlocked)."
],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about the current session, or nil if an error occurred"
],
"signature": "hs.caffeinate.sessionProperties()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.set(sleepType, aValue, acAndBattery)",
"desc": "Configures the sleep prevention settings",
"doc": "Configures the sleep prevention settings\n\nParameters:\n * sleepType - A string containing the type of sleep to be configured. The value should be one of:\n * displayIdle - Controls whether the screen will be allowed to sleep (and also the system) if the user is idle.\n * systemIdle - Controls whether the system will be allowed to sleep if the user is idle (display may still sleep).\n * system - Controls whether the system will be allowed to sleep for any reason.\n * aValue - A boolean, true if the specified type of sleep should be prevented, false if it should be allowed\n * acAndBattery - A boolean, true if the sleep prevention should apply to both AC power and battery power, false if it should only apply to AC power.\n\nReturns:\n * None\n\nNotes:\n * These calls are not guaranteed to prevent the system sleep behaviours described above. The OS may override them if it feels it must (e.g. if your CPU temperature becomes dangerously high).\n * The acAndBattery argument only applies to the `system` sleep type.\n * You can toggle the acAndBattery state by calling `hs.caffeinate.set()` again and altering the acAndBattery value.\n * The acAndBattery option does not appear to work anymore - it is based on private API that is not allowed in macOS 10.15 when running with the Hardened Runtime (which Hammerspoon now uses).",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "11",
"name": "set",
"notes": [
" * These calls are not guaranteed to prevent the system sleep behaviours described above. The OS may override them if it feels it must (e.g. if your CPU temperature becomes dangerously high).",
" * The acAndBattery argument only applies to the `system` sleep type.",
" * You can toggle the acAndBattery state by calling `hs.caffeinate.set()` again and altering the acAndBattery value.",
" * The acAndBattery option does not appear to work anymore - it is based on private API that is not allowed in macOS 10.15 when running with the Hardened Runtime (which Hammerspoon now uses)."
],
"parameters": [
" * sleepType - A string containing the type of sleep to be configured. The value should be one of:\n * displayIdle - Controls whether the screen will be allowed to sleep (and also the system) if the user is idle.\n * systemIdle - Controls whether the system will be allowed to sleep if the user is idle (display may still sleep).\n * system - Controls whether the system will be allowed to sleep for any reason.",
" * aValue - A boolean, true if the specified type of sleep should be prevented, false if it should be allowed",
" * acAndBattery - A boolean, true if the sleep prevention should apply to both AC power and battery power, false if it should only apply to AC power."
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.set(sleepType, aValue, acAndBattery)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.shutdownSystem()",
"desc": "Request the system log out and power down",
"doc": "Request the system log out and power down\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "161",
"name": "shutdownSystem",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.shutdownSystem()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.startScreensaver()",
"desc": "Request the system start the screensaver (which may lock the screen if the OS is configured to do so)",
"doc": "Request the system start the screensaver (which may lock the screen if the OS is configured to do so)\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "122",
"name": "startScreensaver",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.startScreensaver()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.systemSleep()",
"desc": "Requests the system to sleep immediately",
"doc": "Requests the system to sleep immediately\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "193",
"name": "systemSleep",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.systemSleep()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.toggle(sleepType) -> bool or nil",
"desc": "Toggles the current state of the specified type of sleep",
"doc": "Toggles the current state of the specified type of sleep\n\nParameters:\n * sleepType - A string containing the type of sleep to toggle (see [hs.caffeinate.set()](#set) for information about the possible values)\n\nReturns:\n * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value\n\nNotes:\n * If systemIdle is toggled to on, it will apply to AC only",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "82",
"name": "toggle",
"notes": [
" * If systemIdle is toggled to on, it will apply to AC only"
],
"parameters": [
" * sleepType - A string containing the type of sleep to toggle (see [hs.caffeinate.set()](#set) for information about the possible values)"
],
"returns": [
" * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value"
],
"signature": "hs.caffeinate.toggle(sleepType) -> bool or nil",
"stripped_doc": "",
"type": "Function"
}
],
"Method": [],
"Variable": [],
"desc": "Control system power states (sleeping, preventing sleep, screen locking, etc)",
"doc": "Control system power states (sleeping, preventing sleep, screen locking, etc)\n\n**NOTE**: Any sleep preventions will be removed when hs.reload() is called. A future version of the module will save/restore state across reloads.",
"items": [
{
"def": "hs.caffeinate.currentAssertions()",
"desc": "Fetches information about processes which are currently asserting display/power sleep restrictions",
"doc": "Fetches information about processes which are currently asserting display/power sleep restrictions\n\nParameters:\n * None\n\nReturns:\n * A table containing information about current power assertions, with process IDs (PID) as the keys, each of which may contain multiple assertions",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "296",
"name": "currentAssertions",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about current power assertions, with process IDs (PID) as the keys, each of which may contain multiple assertions"
],
"signature": "hs.caffeinate.currentAssertions()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.declareUserActivity([id])",
"desc": "Informs the OS that the user performed some activity",
"doc": "Informs the OS that the user performed some activity\n\nParameters:\n * id - An option number containing the assertion ID returned by a previous call of this function\n\nReturns:\n * A number containing the ID of the assertion generated by this function\n\nNotes:\n * This is intended to simulate user activity, for example to prevent displays from sleeping, or to wake them up\n * It is not mandatory to re-use assertion IDs if you are calling this function mulitple times, but it is recommended that you do so if the calls are related",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "209",
"name": "declareUserActivity",
"notes": [
" * This is intended to simulate user activity, for example to prevent displays from sleeping, or to wake them up",
" * It is not mandatory to re-use assertion IDs if you are calling this function mulitple times, but it is recommended that you do so if the calls are related"
],
"parameters": [
" * id - An option number containing the assertion ID returned by a previous call of this function"
],
"returns": [
" * A number containing the ID of the assertion generated by this function"
],
"signature": "hs.caffeinate.declareUserActivity([id])",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.fastUserSwitch()",
"desc": "Show the Fast User Switch screen (ie a login screen without logging out first)",
"doc": "Show the Fast User Switch screen (ie a login screen without logging out first)\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "109",
"name": "fastUserSwitch",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.fastUserSwitch()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.get(sleepType) -> bool or nil",
"desc": "Queries whether a particular sleep type is being prevented",
"doc": "Queries whether a particular sleep type is being prevented\n\nParameters:\n * sleepType - A string containing the type of sleep to inspect (see [hs.caffeinate.set()](#set) for information about the possible values)\n\nReturns:\n * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "55",
"name": "get",
"notes": [],
"parameters": [
" * sleepType - A string containing the type of sleep to inspect (see [hs.caffeinate.set()](#set) for information about the possible values)"
],
"returns": [
" * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value"
],
"signature": "hs.caffeinate.get(sleepType) -> bool or nil",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.lockScreen()",
"desc": "Locks the displays",
"doc": "Locks the displays\n\nParameters:\n * None\n\nReturns:\n * None\n\nNotes:\n * This function uses private Apple APIs and could therefore stop working in any given release of macOS without warning.",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "237",
"name": "lockScreen",
"notes": [
" * This function uses private Apple APIs and could therefore stop working in any given release of macOS without warning."
],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.lockScreen()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.logOut()",
"desc": "Request the system log out the current user",
"doc": "Request the system log out the current user\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "135",
"name": "logOut",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.logOut()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.restartSystem()",
"desc": "Request the system reboot",
"doc": "Request the system reboot\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "148",
"name": "restartSystem",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.restartSystem()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.sessionProperties()",
"desc": "Fetches information from the display server about the current session",
"doc": "Fetches information from the display server about the current session\n\nParameters:\n * None\n\nReturns:\n * A table containing information about the current session, or nil if an error occurred\n\nNotes:\n * The keys in this dictionary will vary based on the current state of the system (e.g. local vs VNC login, screen locked vs unlocked).",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "271",
"name": "sessionProperties",
"notes": [
" * The keys in this dictionary will vary based on the current state of the system (e.g. local vs VNC login, screen locked vs unlocked)."
],
"parameters": [
" * None"
],
"returns": [
" * A table containing information about the current session, or nil if an error occurred"
],
"signature": "hs.caffeinate.sessionProperties()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.set(sleepType, aValue, acAndBattery)",
"desc": "Configures the sleep prevention settings",
"doc": "Configures the sleep prevention settings\n\nParameters:\n * sleepType - A string containing the type of sleep to be configured. The value should be one of:\n * displayIdle - Controls whether the screen will be allowed to sleep (and also the system) if the user is idle.\n * systemIdle - Controls whether the system will be allowed to sleep if the user is idle (display may still sleep).\n * system - Controls whether the system will be allowed to sleep for any reason.\n * aValue - A boolean, true if the specified type of sleep should be prevented, false if it should be allowed\n * acAndBattery - A boolean, true if the sleep prevention should apply to both AC power and battery power, false if it should only apply to AC power.\n\nReturns:\n * None\n\nNotes:\n * These calls are not guaranteed to prevent the system sleep behaviours described above. The OS may override them if it feels it must (e.g. if your CPU temperature becomes dangerously high).\n * The acAndBattery argument only applies to the `system` sleep type.\n * You can toggle the acAndBattery state by calling `hs.caffeinate.set()` again and altering the acAndBattery value.\n * The acAndBattery option does not appear to work anymore - it is based on private API that is not allowed in macOS 10.15 when running with the Hardened Runtime (which Hammerspoon now uses).",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "11",
"name": "set",
"notes": [
" * These calls are not guaranteed to prevent the system sleep behaviours described above. The OS may override them if it feels it must (e.g. if your CPU temperature becomes dangerously high).",
" * The acAndBattery argument only applies to the `system` sleep type.",
" * You can toggle the acAndBattery state by calling `hs.caffeinate.set()` again and altering the acAndBattery value.",
" * The acAndBattery option does not appear to work anymore - it is based on private API that is not allowed in macOS 10.15 when running with the Hardened Runtime (which Hammerspoon now uses)."
],
"parameters": [
" * sleepType - A string containing the type of sleep to be configured. The value should be one of:\n * displayIdle - Controls whether the screen will be allowed to sleep (and also the system) if the user is idle.\n * systemIdle - Controls whether the system will be allowed to sleep if the user is idle (display may still sleep).\n * system - Controls whether the system will be allowed to sleep for any reason.",
" * aValue - A boolean, true if the specified type of sleep should be prevented, false if it should be allowed",
" * acAndBattery - A boolean, true if the sleep prevention should apply to both AC power and battery power, false if it should only apply to AC power."
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.set(sleepType, aValue, acAndBattery)",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.shutdownSystem()",
"desc": "Request the system log out and power down",
"doc": "Request the system log out and power down\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "161",
"name": "shutdownSystem",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.shutdownSystem()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.startScreensaver()",
"desc": "Request the system start the screensaver (which may lock the screen if the OS is configured to do so)",
"doc": "Request the system start the screensaver (which may lock the screen if the OS is configured to do so)\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/caffeinate.lua",
"lineno": "122",
"name": "startScreensaver",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.startScreensaver()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.systemSleep()",
"desc": "Requests the system to sleep immediately",
"doc": "Requests the system to sleep immediately\n\nParameters:\n * None\n\nReturns:\n * None",
"examples": [],
"file": "extensions/caffeinate/libcaffeinate.m",
"lineno": "193",
"name": "systemSleep",
"notes": [],
"parameters": [
" * None"
],
"returns": [
" * None"
],
"signature": "hs.caffeinate.systemSleep()",
"stripped_doc": "",
"type": "Function"
},
{
"def": "hs.caffeinate.toggle(sleepType) -> bool or nil",
"desc": "Toggles the current state of the specified type of sleep",
"doc": "Toggles the current state of the specified type of sleep\n\nParameters:\n * sleepType - A string containing the type of sleep to toggle (see [hs.caffeinate.set()](#set) for information about the possible values)\n\nReturns:\n * True if the specified type of sleep is being prevented, false if not. nil if sleepType was an invalid value\n\nNot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment