Skip to content

macOS ​

macOS 是由苹果公司开发的图形化操作系统,作为首个在商用领域成功的图形用户界面系统,专为 Macintosh 系列电脑设计,采用 XNU 混合内核架构并继承 UNIX 系统特性。Protocol Launcher 允许你生成深度链接,用于打开并与 macOS 内置应用程序(如日历、FaceTime、查找、邮件、短信和钱包)进行交互。

使用 ​

提供两种使用方式:

  • 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
  • 全量导入(从根包导入),使用简单,但会包含所有应用模块。

生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

打开日历 ​

打开日历应用程序,可选择带 webcal 订阅链接。

On-Demand
ts
import { calendar } from 'protocol-launcher/macos'

// 打开日历应用
const url = calendar()

// 打开带 webcal 订阅的日历
const url = calendar({
  link: 'https://p10-calendars.icloud.com/holiday/CN_zh.ics',
})

打开 FaceTime ​

打开 FaceTime 应用程序,可选择带电话号码。

On-Demand
ts
import { facetime } from 'protocol-launcher/macos'

const url = facetime({
  phone: '1234567890',
})

打开查找 ​

打开查找应用程序,可选择指定标签页(设备、物品或联系人)。

On-Demand
ts
import { findMy } from 'protocol-launcher/macos'

// 打开查找应用
const url = findMy()

// 打开设备标签页
const url = findMy({
  tab: 'devices',
})

// 打开物品标签页
const url = findMy({
  tab: 'items',
})

// 打开联系人标签页
const url = findMy({
  tab: 'friends',
})

打开邮件 ​

打开邮件应用程序。

On-Demand
ts
import { mail } from 'protocol-launcher/macos'

const url = mail()

打开短信 ​

打开短信应用程序,可选择带电话号码。

On-Demand
ts
import { sms } from 'protocol-launcher/macos'

// 打开短信应用
const url = sms()

// 打开带电话号码的短信
const url = sms({
  phone: '1234567890',
})

打开钱包 ​

打开钱包应用程序。

On-Demand
ts
import { wallet } from 'protocol-launcher/macos'

const url = wallet()

打开通讯录 ​

打开通讯录应用程序。

On-Demand
ts
import { addressbook } from 'protocol-launcher/macos'

const url = addressbook()

打开反馈 ​

打开反馈助手应用程序,可选择提交新反馈。

On-Demand
ts
import { feedback } from 'protocol-launcher/macos'

// 打开反馈助手
const url = feedback()

// 打开反馈助手提交新反馈
const url = feedback({
  type: 'new',
})

打开备忘录 ​

打开备忘录应用程序。

On-Demand
ts
import { notes } from 'protocol-launcher/macos'

const url = notes()

打开提醒事项 ​

打开提醒事项应用程序。

On-Demand
ts
import { reminders } from 'protocol-launcher/macos'

const url = reminders()

打开股票 ​

打开股票应用程序,可选择带股票代码。

On-Demand
ts
import { stocks } from 'protocol-launcher/macos'

// 打开股票应用
const url = stocks()

// 打开带股票代码的股票
const url = stocks({
  symbol: 'GE',
})

打开视频 ​

打开视频应用程序。

On-Demand
ts
import { videos } from 'protocol-launcher/macos'

const url = videos()

打开天气 ​

打开天气应用程序。

On-Demand
ts
import { weather } from 'protocol-launcher/macos'

const url = weather()

打开图书 ​

打开图书应用程序。

On-Demand
ts
import { books } from 'protocol-launcher/macos'

const url = books()

打开音乐 ​

打开音乐应用程序。

On-Demand
ts
import { music } from 'protocol-launcher/macos'

const url = music()

打开照片 ​

打开照片应用程序。

On-Demand
ts
import { photos } from 'protocol-launcher/macos'

const url = photos()

打开播客 ​

打开播客应用程序。

On-Demand
ts
import { podcasts } from 'protocol-launcher/macos'

const url = podcasts()

打开系统设置 ​

打开系统设置应用程序,可选择指定偏好设置面板。

On-Demand
ts
import { systemPreferences } from 'protocol-launcher/macos'

// 打开系统设置
const url = systemPreferences()

// 打开安全性与隐私面板
const url = systemPreferences({
  pane: 'com.apple.preference.security',
})

// 打开软件更新面板
const url = systemPreferences({
  pane: 'com.apple.preferences.softwareupdate',
})

打开 Airport 实用工具 ​

打开 Airport 实用工具应用程序。

On-Demand
ts
import { airport } from 'protocol-launcher/macos'

const url = airport()

打开词典 ​

搜索词典查找术语。

On-Demand
ts
import { dictionary } from 'protocol-launcher/macos'

// 搜索词典
const url = dictionary()

// 搜索带术语的词典
const url = dictionary({
  term: 'hello',
})

打开无边记 ​

打开无边记应用程序。

On-Demand
ts
import { freeform } from 'protocol-launcher/macos'

const url = freeform()

打开帮助查看器 ​

打开帮助查看器应用程序,可选择指定合集。

On-Demand
ts
import { helpViewer } from 'protocol-launcher/macos'

// 打开帮助查看器
const url = helpViewer()

// 打开带合集的帮助查看器
const url = helpViewer({
  collection: 'WelcomeToMac',
})

添加打印机 ​

添加打印机,可选择带主机名或 IP 地址。

On-Demand
ts
import { printer } from 'protocol-launcher/macos'

// 添加打印机
const url = printer()

// 添加带主机的打印机
const url = printer({
  host: '192.168.1.100',
})

打开 Apple 密码 (OTP Auth) ​

打开 Apple 密码 (OTP Auth) 应用。

On-Demand
ts
import { appleOtpauth } from 'protocol-launcher/macos'

const url = appleOtpauth()

打开字体册 ​

打开字体册应用。

On-Demand
ts
import { fontbook } from 'protocol-launcher/macos'

const url = fontbook()

打开 Keynote ​

打开 Keynote 应用。

On-Demand
ts
import { keynote } from 'protocol-launcher/macos'

const url = keynote()

打开 Numbers ​

打开 Numbers 应用。

On-Demand
ts
import { numbers } from 'protocol-launcher/macos'

const url = numbers()

打开 Pages ​

打开 Pages 应用。

On-Demand
ts
import { pages } from 'protocol-launcher/macos'

const url = pages()