GridCraft.Action

Hotkeys and their handless.

API Overview #

  • Constructors - API calls which return an object, typically one that offers API methods

API Documentation #

Constructors #

new #

SignatureGridCraft.Action.new(table) -> table
TypeConstructor
Description

Create a new action for a grid

Parameters
  • arg - A table containing the parameters for the action.
    • Basic parameters:
      • mods: (table) Modifier keys like {"cmd", "ctrl"} to trigger the action along with the key. Use {} for no modifiers
      • key: (string) A key to trigger the action along with the modifiers, like “x” or “F11”.
      • handler: (function) Code to run when the key is pressed
      • description: (string) A description for the action
      • icon: (string) An svg or img tag to display as the icon for the action (optional)
      • classes: (table) A list of classes to apply to the action in the web view (optional)
    • Convenience parameters:
      • empty: (boolean) If true, the handler is set to a no-op function and the description is set to “No action”. This is useful for creating empty slots in the grid. Overrides handler, description, and icon.
      • application: (string) The name of an application to switch to. Overrides handler. If description/icon are not provided, set to app name/icon.
      • submenu: (table) A table of actions to create a submenu for this action. Overrides handler.
Notes
  • Together, the mods and key are passed to hs.hotkey.bind() to create a regular Hammerspoon hotkey.