/
run_c-configure-dock-osx.sh.tmpl
38 lines (34 loc) · 2.83 KB
/
run_c-configure-dock-osx.sh.tmpl
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
{{ if eq .chezmoi.os "darwin" -}}
#!/bin/sh
# Write a temporary file containing the template needed for adding an item to the dock, having "APP_PATH" & "APP_NAME" as placeholders.
# The basic template was taken from here: http://hints.macworld.com/article.php?story=20040819170450489
cat > /tmp/dock-config-template <<- EOF
<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>APP_PATH</string><key>_CFURLStringType</key><integer>0</integer></dict><key>file-label</key><string>APP_NAME</string></dict><key>tile-type</key><string>file-tile</string></dict>
EOF
# Add the following applications to the dock:
# * ITerm
# * Slack
# * Visual Studio Code
# * Google Chrome
# * Google Chrome Canary
# * Firefox
# * Firefox Nightly
# * Safari
# * Safari Technology Preview
# * Microsoft Edge
# * Microsoft Edge Dev
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/ITerm.app/g" -e "s/APP_NAME/ITerm/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Slack.app/g" -e "s/APP_NAME/Slack/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Visual\ Studio\ Code.app/g" -e "s/APP_NAME/Visual Studio Code/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Google\ Chrome.app/g" -e "s/APP_NAME/Google Chrome/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Google\ Chrome\ Canary.app/g" -e "s/APP_NAME/Google Chrome Canary/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Firefox.app/g" -e "s/APP_NAME/Firefox/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Firefox\ Nightly.app/g" -e "s/APP_NAME/Firefox Nightly/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Safari.app/g" -e "s/APP_NAME/Safari/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Safari\ Technology\ Preview.app/g" -e "s/APP_NAME/Safari Technology Preview/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Microsoft\ Edge.app/g" -e "s/APP_NAME/Microsoft Edge/" /tmp/dock-config-template)"
defaults write com.apple.dock persistent-apps -array-add "$(sed -e "s/APP_PATH/\/Applications\/Microsoft\ Edge\ Dev.app/g" -e "s/APP_NAME/Microsoft Edge Dev/" /tmp/dock-config-template)"
# Remove the temporary template file.
rm -rf /tmp/dock-config-template
killall Dock
{{ end -}}