Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (29 sloc) 934 Bytes
-- Found on: https://gist.githubusercontent.com/daGrevis/79b27b9c156ba828ad52976a118b29e0/raw/0e77383f4eb9301527caac3f0b71350e9499210b/init.lua
function airPods(deviceName)
local s = [[
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell btMenu
click
]]
..
'tell (menu item "' .. deviceName .. '" of menu 1)\n'
..
[[
click
if exists menu item "Connect" of menu 1 then
click menu item "Connect" of menu 1
return "Connecting AirPods..."
else
click menu item "Disconnect" of menu 1
return "Disconnecting AirPods..."
end if
end tell
end tell
end tell
end tell
]]
return hs.osascript.applescript(s)
end
You can’t perform that action at this time.