-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockutil-labels-user.sh
389 lines (315 loc) · 9.13 KB
/
dockutil-labels-user.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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
DEPLOG=/var/tmp/depnotify.log
echo *** DOCKUTIL LABELS AS USER ***
currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }')
uid=$(id -u "$currentUser")
runAsUser() {
if [ "$currentUser" != "loginwindow" ]; then
launchctl asuser "$uid" sudo -u "$currentUser" "$@"
else
echo "No user logged in."
# uncomment the exit command
# to make the function exit with an error when no user is logged in
# exit 1
fi
}
# ********************************************************************************************************************************
# APP LABELS
# ********************************************************************************************************************************
if [ -z "$DOCKPOS" ]; then
echo "Dock Position is not set, adding $@ to the end of the dock"
DOCKPOS=end
fi
# BROWSERS
if [[ " $@ " =~ "safari" ]]; then
APPNA="Safari"
APPPA="/Applications"
fi
if [[ " $@ " =~ "googlechrome" ]]; then
APPNA="Google Chrome"
APPPA="/Applications"
fi
if [[ " $@ " =~ "googlechromeenterprise" ]]; then
APPNA="Google Chrome"
APPPA="/Applications"
fi
if [[ " $@ " =~ "firefox" ]]; then
APPNA="Firefox"
APPPA="/Applications"
fi
if [[ " $@ " =~ "brave" ]]; then
APPNA="Brave Browser"
APPPA="/Applications"
fi
# MICROSOFT OFFICE APPS
if [[ " $@ " =~ "microsoftword" ]]; then
APPNA="Microsoft Word"
APPPA="/Applications"
fi
if [[ " $@ " =~ "microsoftexcel" ]]; then
APPNA="Microsoft Excel"
APPPA="/Applications"
fi
if [[ " $@ " =~ "microsoftpowerpoint" ]]; then
APPNA="Microsoft Powerpoint"
APPPA="/Applications"
fi
if [[ " $@ " =~ "microsoftoutlook" ]]; then
APPNA="Microsoft Outlook"
APPPA="/Applications"
fi
if [[ " $@ " =~ "microsoftonenote" ]]; then
APPNA="Microsoft OneNote"
APPPA="/Applications"
fi
# CLOUD STORAGE APPS
if [[ " $@ " =~ "dropbox" ]]; then
APPNA="Dropbox"
APPPA="/Applications"
fi
if [[ " $@ " =~ "microsoftonedrive" ]]; then
APPNA="OneDrive"
APPPA="/Applications"
fi
# VIDEO MEETING APPS
if [[ " $@ " =~ "slack" ]]; then
APPNA="Slack"
APPPA="/Applications"
fi
if [[ " $@ " =~ "microsoftteams" ]]; then
APPNA="Microsoft Teams"
APPPA="/Applications"
fi
if [[ " $@ " =~ "zoom" ]]; then
APPNA="zoom.us"
APPPA="/Applications"
fi
if [[ " $@ " =~ "skype" ]]; then
APPNA="Skype"
APPPA="/Applications"
fi
# ADOBE APPS
if [[ " $@ " =~ "photoshop2022" ]]; then
APPNA="Adobe Photoshop 2022"
APPPA="/Applications/Adobe Photoshop 2022"
fi
if [[ " $@ " =~ "indesign2022" ]]; then
APPNA="Adobe InDesign 2022"
APPPA="/Applications/Adobe InDesign 2022"
fi
if [[ " $@ " =~ "illustrator2022" ]]; then
APPNA="Adobe Illustrator"
APPPA="/Applications/Adobe Illustrator 2022"
fi
if [[ " $@ " =~ "acrobatdc" ]]; then
APPNA="Adobe Acrobat"
APPPA="/Applications/Adobe Acrobat DC"
fi
if [[ " $@ " =~ "adobereaderdc" ]]; then
APPNA="Adobe Acrobat Reader"
APPPA="/Applications"
fi
if [[ " $@ " =~ "adobecreativeclouddesktop" ]]; then
APPNA="Creative Cloud"
APPPA="/Applications/Utilities/Adobe Creative Cloud/ACC"
fi
#OTHERS
if [[ " $@ " =~ "console" ]]; then
APPNA="Console"
APPPA="/Applications/Utilities"
fi
if [[ " $@ " =~ "activitymonitor" ]]; then
APPNA="Activity Monitor"
APPPA="/Applications/Utilities"
fi
if [[ " $@ " =~ "diskutility" ]]; then
APPNA="Disk Utility"
APPPA="/Applications/Utilities"
fi
if [[ " $@ " =~ "terminal" ]]; then
APPNA="Terminal"
APPPA="/Applications/Utilities"
fi
if [[ " $@ " =~ "mail" ]]; then
APPNA="Mail"
APPPA="/Applications"
fi
if [[ " $@ " =~ "maps" ]]; then
APPNA="Maps"
APPPA="/Applications"
fi
if [[ " $@ " =~ "news" ]]; then
APPNA="News"
APPPA="/Applications"
fi
if [[ " $@ " =~ "filezilla" ]]; then
APPNA="FileZilla"
APPPA="/Applications"
fi
if [[ " $@ " =~ "teamviewer" ]]; then
APPNA="TeamViewer"
APPPA="/Applications"
fi
if [[ " $@ " =~ "teamviewerhost" ]]; then
APPNA="TeamViewer Host"
APPPA="/Applications"
fi
if [[ " $@ " =~ "appleremotedesktop" ]]; then
APPNA="Remote Desktop"
APPPA="/Applications"
fi
if [[ " $@ " =~ "screensharing" ]]; then
APPNA="Screen Sharing"
APPPA="/System/Library/CoreServices/Applications"
fi
if [[ " $@ " =~ "microsoftremotedesktop" ]]; then
APPNA="Microsoft Remote Desktop"
APPPA="/Applications"
fi
if [[ " $@ " =~ "1password8" ]]; then
APPNA="1Password"
APPPA="/Applications"
fi
if [[ " $@ " =~ "1password7" ]]; then
APPNA="1Password 7"
APPPA="/Applications"
fi
if [[ " $@ " =~ "filemakerpro" ]]; then
APPNA="FileMaker Pro"
APPPA="/Applications"
fi
if [[ " $@ " =~ "keka" ]]; then
APPNA="Keka"
APPPA="/Applications"
fi
if [[ " $@ " =~ "icons" ]]; then
APPNA="Icons"
APPPA="/Applications"
fi
if [[ " $@ " =~ "cyberduck" ]]; then
APPNA="Cyberduck"
APPPA="/Applications"
fi
if [[ " $@ " =~ "asana" ]]; then
APPNA="Asana"
APPPA="/Applications"
fi
if [[ " $@ " =~ "googledrive" ]]; then
APPNA="Google Drive"
APPPA="/Applications"
fi
# NOT KNOWN TO INSTALLOMATOR - USE FOR DOCK POPULATION ONLY
if [[ " $@ " =~ "zywallsecuextender" ]]; then
APPNA="ZyWALL SecuExtender"
APPPA="/Applications"
fi
if [[ " $@ " =~ "redstorproese" ]]; then
APPNA="Redstor Pro ESE"
APPPA="/Applications"
fi
if [[ " $@ " =~ "mitelconnect" ]]; then
APPNA="Mitel Connect"
APPPA="/Applications"
fi
if [[ " $@ " =~ "transmit" ]]; then
APPNA="Transmit"
APPPA="/Applications"
fi
if [[ " $@ " =~ "monday" ]]; then
APPNA="monday.com"
APPPA="/Applications"
fi
if [[ " $@ " =~ "filemaker15" ]]; then
APPNA="FileMaker Pro"
APPPA="/Applications/FileMaker Pro 15"
fi
if [[ " $@ " =~ "excellcloudvoice" ]]; then
APPNA="Excell Cloud Voice Plus"
APPPA="/Applications"
fi
if [[ " $@ " =~ "accountedgene" ]]; then
APPNA="AccountEdge NE"
APPPA="/Applications"
fi
if [[ " $@ " =~ "3cx" ]]; then
APPNA="3CX Desktop App"
APPPA="/Applications"
fi
if [[ " $@ " =~ "nordlayer" ]]; then
APPNA="NordLayer"
APPPA="/Applications"
fi
if [[ " $@ " =~ "nordpass" ]]; then
APPNA="NordPass"
APPPA="/Applications"
fi
if [[ " $@ " =~ "btcloudphone" ]]; then
APPNA="BT Cloud Phone"
APPPA="/Applications"
fi
# ********************************************************************************************************************************
# END APP LABELS
# ********************************************************************************************************************************
# MOSYLE SELF SERVICE
if [[ " $@ " =~ "mosyless" ]]; then
APPNA="Self-Service"
APPPA="/Applications"
DOCKPOS=2
fi
# SYSTEM PREFERENCES
if [[ " $@ " =~ "systempreferences" ]]; then
APPNA="System Preferences"
APPPA="/Applications"
fi
# SYSTEM PREFERENCES
if [[ " $@ " =~ "systemsettings" ]]; then
APPNA="System Settings"
APPPA="/Applications"
fi
# LAUNCHPAD
if [[ " $@ " =~ "launchpad" ]]; then
APPNA="Launchpad"
APPPA="/Applications"
DOCKPOS=1
fi
# ********************************************************************************************************************************
# EXECUTE TASK
# ********************************************************************************************************************************
if [[ " $@ " =~ "microsoftoffice365" ]]; then
APPNA="Microsoft Office"
echo "Status: adding $APPNA to the Dock" >> $DEPLOG
echo "removing $APPNA from the Dock"
runAsUser /usr/local/bin/dockutil --remove "Microsoft Word" --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
runAsUser /usr/local/bin/dockutil --remove "Microsoft Excel" --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
runAsUser /usr/local/bin/dockutil --remove "Microsoft Powerpoint" --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
runAsUser /usr/local/bin/dockutil --remove "Microsoft Outlook" --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
echo "adding Microsoft Office to the Dock"
sleep .5
runAsUser /usr/local/bin/dockutil --add /Applications/Microsoft\ Word.app --position 6 --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
runAsUser /usr/local/bin/dockutil --add /Applications/Microsoft\ Excel.app --position 7 --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
runAsUser /usr/local/bin/dockutil --add /Applications/Microsoft\ Powerpoint.app --position 8 --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
runAsUser /usr/local/bin/dockutil --add /Applications/Microsoft\ Outlook.app --position 9 --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
else
echo "Status: adding $APPNA to the Dock" >> $DEPLOG
echo "removing $APPNA from the Dock"
runAsUser /usr/local/bin/dockutil --remove "$APPNA" --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
echo "adding $APPNA to the Dock"
runAsUser /usr/local/bin/dockutil --add "$APPPA/$APPNA.app" --position $DOCKPOS --no-restart --homeloc /Users/$(stat -f "%Su" /dev/console)/
sleep .5
fi
# ********************************************************************************************************************************
# END EXECUTION
# ********************************************************************************************************************************
# ERROR RESPONSES
if [[ " $@ " =~ '' ]]; then
# whatever you want to do when array contains value
echo No Label Provided
fi