Skip to content

Shortcuts

Shortcuts is a powerful automation tool for iOS, iPadOS, and macOS that lets you accomplish more with less effort. With Shortcuts, you can quickly perform everyday tasks by simply saying a few words or tapping a button. You can create custom shortcuts that combine multiple steps from different apps into one streamlined action, or choose from hundreds of pre-made shortcuts in the Gallery. Protocol Launcher allows you to generate deep links to open Shortcuts and interact with your workflows.

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.

Open Shortcuts

On-Demand
ts
import { open } from 'protocol-launcher/shortcuts'

const url = open()

Create Shortcut

Create a new shortcut in Shortcuts.

On-Demand
ts
import { create } from 'protocol-launcher/shortcuts'

const url = create()

Open the Shortcuts Gallery to browse and discover shortcuts.

On-Demand
ts
import { openGallery } from 'protocol-launcher/shortcuts'

// Open gallery without search
const url = openGallery()

// Open gallery with search query
const url = openGallery({
  query: 'photos',
})

Open Shortcut

Open a specific shortcut in the gallery.

On-Demand
ts
import { openShortcut } from 'protocol-launcher/shortcuts'

const url = openShortcut({
  name: 'Kaleidoscope Compare',
})

Run Shortcut

Run a specific shortcut with optional input.

On-Demand
ts
import { runShortcut } from 'protocol-launcher/shortcuts'

// Run shortcut without input
const url = runShortcut({
  name: 'Kaleidoscope Compare',
})

// Run shortcut with text input
const url = runShortcut({
  name: '将文本转为音频',
  input: 'text',
  text: '测试将文本转为音频',
})

// Run shortcut with clipboard input
const url = runShortcut({
  name: 'Add to Notes',
  input: 'clipboard',
})

Run Shortcut with X-Callback-URL

Run a shortcut using the x-callback-url protocol for advanced callback handling.

On-Demand
ts
import { xCallbackRunShortcut } from 'protocol-launcher/shortcuts'

// Run shortcut without callbacks
const url = xCallbackRunShortcut({
  name: '计算小费',
  input: 'text',
  text: '24.99',
})

// Run shortcut with success and cancel callbacks
const url = xCallbackRunShortcut({
  name: '计算小费',
  input: 'text',
  text: '24.99',
  xSuccess: 'myapp://success',
  xCancel: 'myapp://cancel',
})