Are you an LLM? You can read better optimized documentation at /zh/apps/launchbar.md for this page in Markdown format
LaunchBar
LaunchBar 是一款 macOS 启动器与效率工具。Protocol Launcher 可以为 LaunchBar 生成深度链接。
使用方式
提供两种使用方式:
- 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
- 全量导入(从根包导入),使用简单,但会包含所有应用模块。
生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
URL 方法
以下 helper 对应 LaunchBar 官方 URL Commands 与 Calculator 文档。官方说明 execute 命令只能配合 LaunchBar 搜索模板(Search Templates)使用。
大字显示
On-Demand
ts
import { largeType } from 'protocol-launcher/launchbar'
const url = largeType({
string: 'LaunchBar 4.3',
})
const titleUrl = largeType({
title: 'Large Type',
string: 'Small Example',
})
const fontUrl = largeType({
fontName: 'Times-Bold',
string: 'Hello World',
})选中项目
On-Demand
ts
import { select } from 'protocol-launcher/launchbar'
const fileUrl = select({
file: '/Applications',
})
const urlItem = select({
url: 'www.obdev.at',
})
const namedUrl = select({
url: 'www.obdev.at',
name: 'Objective Development',
})
const stringUrl = select({
string: "Hello, I'm a text",
})
const abbreviationUrl = select({
abbreviation: 'SAFARI',
})执行搜索模板命令
On-Demand
ts
import { execute } from 'protocol-launcher/launchbar'
const singleArgumentUrl = execute({
path: '/usr/local/bin/MyScript',
argument: '*',
})
const argumentsUrl = execute({
path: '/usr/bin/open',
arguments: '-a "*"',
})计算
On-Demand
ts
import { calculate } from 'protocol-launcher/launchbar'
const url = calculate({
expression: '2*sin(pi/4)^2',
})
const titleUrl = calculate({
expression: '(1+sqrt(5))/2',
title: 'Golden Ratio',
})
const resultUrl = calculate({
expression: '(1+sqrt(5))/2',
title: 'Golden Ratio',
result: 'φ=@',
})
const templateUrl = calculate({
argument: '*',
expression: '(@-32)/1.8',
title: '@°F =',
result: '@°C',
})
const celsiusTemplateUrl = calculate({
argument: '*',
expression: '@*1.8+32',
title: '@°C =',
result: '@°F',
})隐藏 LaunchBar
On-Demand
ts
import { hide } from 'protocol-launcher/launchbar'
const url = hide()