forked from scsibug/nostr-rs-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacos_toggle_airplay.sh
executable file
·30 lines (24 loc) · 1.04 KB
/
macos_toggle_airplay.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
osascript <<EOS
on toggle()
tell application "System Preferences" to reveal pane id "com.apple.preferences.sharing"
tell application "System Events" to tell window 1 of application process "System Preferences"
repeat until exists checkbox 1 of (first row of table 1 of scroll area 1 of group 1 whose value of static text 1 is "AirPlay Receiver")
delay 0.1
end repeat
if value of checkbox 1 of (first row of table 1 of scroll area 1 of group 1 whose value of static text 1 is "AirPlay Receiver") as boolean then
click checkbox 1 of (first row of table 1 of scroll area 1 of group 1 whose value of static text 1 is "AirPlay Receiver")
else
click checkbox 1 of (first row of table 1 of scroll area 1 of group 1 whose value of static text 1 is "AirPlay Receiver")
end if
end tell
end toggle
if application "System Preferences" is not running then
tell application "System Preferences" to activate
toggle()
tell application "System Preferences" to quit
else
toggle()
tell application "System Preferences" to quit
end if
EOS