-
Notifications
You must be signed in to change notification settings - Fork 6
/
info.plist
120 lines (116 loc) · 3.45 KB
/
info.plist
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string></string>
<key>connections</key>
<dict>
<key>14D5E084-1B24-4FEC-B287-ADE8530320F2</key>
<array>
<dict>
<key>destinationuid</key>
<string>58FEBA95-060B-4B7C-9516-2B60011E5A3C</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Various Artists</string>
<key>description</key>
<string>Control OpenVPN connections</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Viscosity</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>63</integer>
<key>keyword</key>
<string>vpn</string>
<key>script</key>
<string>STAMP=$(date +%s)
FILTER="{query}"
if [ -z "$FILTER" ]; then FILTER=.;fi
echo '<?xml version="1.0"?><items>'
osascript -sh connections.ascr | tr "\r" "\n" | grep -i $FILTER | while read LINE; do
echo "<item uid=\"${STAMP}\" arg=\"${LINE}\"><title>${LINE}</title>"
if [[ $(osascript -sh state.ascr "${LINE}" | tr "\r" "\n" | grep -i .) == "Connected" ]]; then
echo "<subtitle>Disconnect from this network</subtitle>"
else
echo "<subtitle>Connect to this network</subtitle>"
fi
echo "<icon>icon.png</icon><valid>yes</valid></item>"
done
echo '<item uid="'${STAMP}'" arg="connectall"><title>Connect All</title><subtitle>Connect to all defined networks</subtitle><icon>icon.png</icon><valid>yes</valid></item>'
echo '<item uid="'${STAMP}'" arg="disconnectall"><title>Disconnect All</title><subtitle>Disconnect from all connected networks</subtitle><icon>icon.png</icon><valid>yes</valid></item>'
echo '</items>'
</string>
<key>subtext</key>
<string>Control OpenVPN connections</string>
<key>title</key>
<string>Viscosity</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>14D5E084-1B24-4FEC-B287-ADE8530320F2</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(query)
tell application "Viscosity"
if query = "connectall" then
connectall
else if query = "disconnectall" then
disconnectall
else
set s to state of first connection where name = query
if s is equal to "Connected" then
disconnect query
else
connect query
end if
end if
end tell
end alfred_script
</string>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>58FEBA95-060B-4B7C-9516-2B60011E5A3C</string>
</dict>
</array>
<key>uidata</key>
<dict>
<key>14D5E084-1B24-4FEC-B287-ADE8530320F2</key>
<dict>
<key>ypos</key>
<real>200</real>
</dict>
<key>58FEBA95-060B-4B7C-9516-2B60011E5A3C</key>
<dict>
<key>ypos</key>
<real>200</real>
</dict>
</dict>
<key>webaddress</key>
<string>github.com/andrewschleifer/viscosity-alfredworkflow</string>
</dict>
</plist>