# hs.shortcuts

List and run shortcuts from the Shortcuts app

Separate from this extension, Hammerspoon provides an action for use in the Shortcuts app. The action is called "Execute Lua" and if it is passed a text block of valid Lua, it will execute that Lua within Hammerspoon. You can use this action to call functions defined in your init.lua or to just execute chunks of Lua.

Your functions/chunks can return text, which will be returned by the action in Shortcuts.


# API Overview

Functions - API calls offered directly by the extension

  • list
  • run

# API Documentation

# Functions

# list

Signature hs.shortcuts.list() -> []
Type Function
Description Returns a list of available shortcuts
Parameters
  • None
Returns
  • A table of shortcuts, each being a table with the following keys:
  • name - The name of the shortcut
  • id - A unique ID for the shortcut
  • acceptsInput - A boolean indicating if the shortcut requires input
  • actionCount - A number relating to how many actions are in the shortcut
Notes None
Examples None
Source extensions/shortcuts/libshortcuts.m line 16

# run

Signature hs.shortcuts.run(name)
Type Function
Description Execute a Shortcuts shortcut by name
Parameters
  • name - A string containing the name of the Shortcut to execute
Returns
  • None
Notes None
Examples None
Source extensions/shortcuts/libshortcuts.m line 50