@@ -12,8 +12,9 @@ function _lazy_connect_init() {
12
12
}
13
13
14
14
function _lazy_connect_vpn_refresh() {
15
- echo " refreshing vpn..."
16
- vpnNames=$( osascript << EOF
15
+ echo " refreshing vpn..."
16
+ cp $config_dir /vpns ${TMPDIR} lc_vpns
17
+ osascript << EOF |
17
18
tell application "System Events"
18
19
tell process "SystemUIServer"
19
20
set vpnMenu to (menu bar item 1 of menu bar 1 where description is "VPN")
@@ -25,20 +26,19 @@ function _lazy_connect_vpn_refresh() {
25
26
set vpnName to name of vpnMenuItem
26
27
if vpnName is equal to missing value then
27
28
exit repeat
28
- end if
29
+ end if
29
30
set vpnNames to vpnNames & {vpnName}
30
- end repeat
31
+ end repeat
31
32
key code 53
32
33
get vpnNames
33
- end tell
34
34
end tell
35
+ end tell
35
36
EOF
36
- )
37
- cp $config_dir /vpns ${TMPDIR} lc_vpns
38
- updated_vpns=$( echo $vpnNames | tr , " \n" | xargs -I{} echo {})
39
- echo $updated_vpns > $config_dir /vpns
40
- echo " Updated VPN List:"
41
- diff $config_dir /vpns ${TMPDIR} lc_vpns
37
+ sed ' s/,[[:space:]]/,/g' \
38
+ | awk ' BEGIN {RS=","} { print }' \
39
+ > $config_dir /vpns
40
+ echo " Updated VPN List:"
41
+ diff $config_dir /vpns ${TMPDIR} lc_vpns
42
42
}
43
43
44
44
function _lazy_connect_usage() {
0 commit comments