hs.spoons.bindHotkeysToSpec(def, map) -> none
hs.alert()
when the hotkey has been triggered, as supported by bindHotkeys in the Spoon API. Not all the entries in def
must be bound, but if any keys in map
don't have a definition, an error will be produced.hs.spoons.isInstalled(name) -> table | nil
| | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Function | | Description | Check if a given Spoon is installed. | | Parameters |list()
. Returns nil
if the Spoon is not installed.hs.spoons.isLoaded(name) -> boolean | nil
| | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Function | | Description | Check if a given Spoon is loaded. | | Parameters |true
if the Spoon is loaded, nil
otherwise.hs.spoons.list() -> table
false
onlyLoaded
). Each entry is a table with the following entries:name
- Spoon nameloaded
- boolean indication of whether the Spoon is loaded (true
) or only installed (false
)version
- Spoon version number. Available only for loaded Spoons.hs.spoons.newSpoon(name, basedir, metadata, [template]) -> string | nil
| | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Function | | Description | Create a skeleton for a new Spoon | | Parameters |.spoon
extension~/.hammerspoon/Spoons
{ version = "0.1", author = "Your Name <[email protected]>", homepage = "https://github.com/Hammerspoon/Spoons", license = "MIT - https://opensource.org/licenses/MIT", download_url = "https://github.com/Hammerspoon/Spoons/raw/master/Spoons/"..name..".spoon.zip" }
init.lua
file of the new Spoon. Defaults to the templates/init.tpl
file included with Hammerspoon.nil
if there was an error.hs.spoons.resourcePath(partial) -> string
images/img1.png
will refer to a file within the images
directory of the Spoon.hs.spoons.scriptPath([n]) -> string
scriptPath()
hs.spoons.use(name, arg, [noerror]) -> boolean | nil
| | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Function | | Description | Declaratively load and configure a Spoon | | Parameters |.spoon
extension).config = { answer = 42 }
will result in spoon.<LoadedSpoon>.answer
being set to 42.bindHotkeys()
method. The special string "default"
can be given to use the Spoons defaultHotkeys
variable, if it exists.logger
, its setLogLevel()
method will be called with this value.true
, call the Spoon's start()
method after configuring everything else.true
, don't log an error if the Spoon is not installed, simply return nil
.true
if the spoon was loaded, nil
otherwise