สำหรับนักพัฒนา

Switchbar API

Switchbar มี API ที่อิงกับ URL เพียงเปิด 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)

ใช้กับ URL ของ Choosy ได้

Switchbar เปิดลิงก์ Choosy API ได้ด้วย สคริปต์และเครื่องมือที่สร้างสำหรับ Choosy จึงใช้งานได้โดยไม่ต้องแก้ไข

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

© 2026 WebCatalog, Inc.