docs » 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

API Documentation


Signature hs.shortcuts.list() -> []
Type Function
Description Returns a list of available shortcuts
  • None
  • 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
Source extensions/shortcuts/libshortcuts.m line 16
Type Function
Description Execute a Shortcuts shortcut by name
  • name - A string containing the name of the Shortcut to execute
  • None
Source extensions/shortcuts/libshortcuts.m line 50