diff --git a/.gitignore b/.gitignore index 1b306b9..85aa074 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ !vscode-neovim/**/* !karabiner/**/* !raycast-export/**/* +!raycast-scripts/**/* !wallpapers/**/* !appicons/**/* diff --git a/raycast-export/Raycast 2023-05-14 09.02.51.rayconfig b/raycast-export/Raycast 2023-05-14 09.02.51.rayconfig new file mode 100644 index 0000000..f852636 Binary files /dev/null and b/raycast-export/Raycast 2023-05-14 09.02.51.rayconfig differ diff --git a/raycast-scripts/airpods-connect.applescript b/raycast-scripts/airpods-connect.applescript new file mode 100755 index 0000000..124b7d3 --- /dev/null +++ b/raycast-scripts/airpods-connect.applescript @@ -0,0 +1,34 @@ +#!/usr/bin/osascript + +# @raycast.schemaVersion 1 +# @raycast.title Switch to AirPods +# @raycast.mode silent + +# @raycast.packageName Audio +# @raycast.icon 🎧 + +# https://gist.github.com/ieatfood/814b065964492f71f728da59a47413bc?permalink_comment_id=3895031#gistcomment-3895031 + +use framework "IOBluetooth" +use scripting additions + +set AirPodsName to "AirPods" + +on getFirstMatchingDevice(deviceName) + repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list) + if (device's nameOrAddress as string) contains deviceName then return device + end repeat +end getFirstMatchingDevice + +on toggleDevice(device) + set quotedDeviceName to quoted form of (device's nameOrAddress as string) + + if not (device's isConnected as boolean) then + device's openConnection() + end if + + do shell script "/opt/homebrew/bin/SwitchAudioSource -s " & quotedDeviceName + return "Connecting " & (device's nameOrAddress as string) +end toggleDevice + +return toggleDevice(getFirstMatchingDevice(AirPodsName))