Skip to content

Hammerspoon

Hammerspoon is a macOS automation tool that lets you script and control the system with Lua.

Usage

There are two ways to use this library:

  • On-Demand import from subpaths enables tree-shaking and keeps bundles small.
  • Full Import from the root package is convenient but includes all app modules.

Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.

Select Installation Method

On-Demand
Recommended. Optimized for production.
Full Import
Convenient. Good for quick scripts.

URL Event

Generate a Hammerspoon URL event for a callback registered with hs.urlevent.bind.

On-Demand
ts
import { urlEvent } from 'protocol-launcher/hammerspoon'

const url = urlEvent({
  eventName: 'doThingA',
  params: {
    value: '1',
  },
})

const multiParamUrl = urlEvent({
  eventName: 'someEventToHandle',
  params: {
    someParam: 'things',
    otherParam: 'stuff',
  },
})

Official Documentation