개발자용

Switchbar API

Switchbar에는 URL 기반 API가 있습니다. 특별한 형식의 URL을 열면 Switchbar가 즉시 작동하여 링크를 올바른 브라우저나 이메일 클라이언트로 보내거나, 하나를 선택하도록 안내합니다.

작동 방식

switchbar://open/<link>
  • 웹 및 이메일 링크

    https://, http://, mailto: 링크를 전달하세요.

  • 내 규칙 적용

    링크는 클릭할 때와 마찬가지로 규칙과 링크 설정을 거칩니다. 일치하는 규칙이 없으면 Switchbar가 어디에서 열지 묻습니다.

  • 인코딩 불필요

    switchbar://open/ 뒤에 링크를 그대로 붙이세요. 퍼센트 인코딩은 필요 없습니다.

예시

Terminal

# macOS
open "switchbar://open/https://example.com"
open "switchbar://open/mailto:hello@example.com"

# Windows
start "" "switchbar://open/https://example.com"

AppleScript

open location "switchbar://open/https://example.com"

JavaScript

window.location.href = "switchbar://open/https://example.com";

Swift

let url = URL(string: "switchbar://open/https://example.com")!
NSWorkspace.shared.open(url)

Choosy URL 지원

Switchbar는 Choosy API 링크도 열 수 있어 Choosy용 스크립트와 도구를 그대로 사용할 수 있습니다.

x-choosy://open/
x-choosy://prompt.all/
x-choosy://prompt.running/
x-choosy://best.all/
x-choosy://best.running/