mirror of
https://github.com/mikkelsvartveit/dotfiles.git
synced 2025-12-22 11:12:39 +00:00
Add Raycast scripts
This commit is contained in:
parent
8fef01eb50
commit
81f2e84392
3 changed files with 35 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,6 +13,7 @@
|
|||
!vscode-neovim/**/*
|
||||
!karabiner/**/*
|
||||
!raycast-export/**/*
|
||||
!raycast-scripts/**/*
|
||||
!wallpapers/**/*
|
||||
!appicons/**/*
|
||||
|
||||
|
|
|
|||
BIN
raycast-export/Raycast 2023-05-14 09.02.51.rayconfig
Normal file
BIN
raycast-export/Raycast 2023-05-14 09.02.51.rayconfig
Normal file
Binary file not shown.
34
raycast-scripts/airpods-connect.applescript
Executable file
34
raycast-scripts/airpods-connect.applescript
Executable file
|
|
@ -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))
|
||||
Loading…
Reference in a new issue