-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·161 lines (122 loc) · 5.12 KB
/
bootstrap.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
#!/bin/sh -
link() { FROM="${1}"; TO="${2}";
echo "Linking '${FROM}' to '${TO}'"
if [ -L "${TO}" ]; then
rm -f "${TO}"
else
echo "File: ${TO} is not a symbolic link"
exit
fi
ln -s "${FROM}" "${TO}"
}
export DOTFILE_PATH="${HOME}/src/github/TechIsCool/dotfiles"
# Symlink everything except '.tmpl'
for LOCATION in $(find bash -name '.*' ! -name '.*.tmpl'); do
FILE="${LOCATION##*/}"
link "${DOTFILE_PATH}/${LOCATION}" "${HOME}/${FILE}"
done
# Copy '.tmpl' since they are considered secure
for LOCATION in $(find bash -name '.*.tmpl'); do
FILE="${LOCATION##*/}"
FILE="${FILE/%.tmpl}"
cp -n "${DOTFILE_PATH}/${LOCATION}" "${HOME}/${FILE}" || true
done
link "${DOTFILE_PATH}/vim/vimfiles" "${HOME}/.vim"
link "${DOTFILE_PATH}/vim/.vimrc" "${HOME}/.vimrc" "${HOME}/.vimrc"
if [[ "$OSTYPE" == "darwin"* ]]; then
for LOCATION in $(find iterm -name '*.json'); do
FILE="${LOCATION##*/}"
link "${DOTFILE_PATH}/${LOCATION}" "${HOME}/Library/Application Support/iTerm2/DynamicProfiles/${FILE}"
done
CURRENT_USER=$(ls -l /dev/console | cut -d " " -f4)
sudo -s -u ${CURRENT_USER} -- <<EOF
# Finder
# new window - use src
defaults write com.apple.finder NewWindowTarget -string "PfLo"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/src"
# full path in banner
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# TaskBar
# Disable siri
defaults write com.apple.Siri StatusMenuVisible -int 0
# defaults write com.apple.siri "StatusMenuVisible" -int 0
# defaults write com.apple.systemuiserver "NSStatusItem Visible Siri" -bool false
# Enable battery Percent
defaults write ${HOME}/Library/Preferences/ByHost/com.apple.controlcenter.plist BatteryShowPercentage -bool true
# Disable Notifications
defaults write ${HOME}/Library/Preferences/ByHost/com.apple.notificationcenterui dndStart -integer 1
defaults write ${HOME}/Library/Preferences/ByHost/com.apple.notificationcenterui dndEnd -integer 1439
# Dock
# Enable Autohide
defaults write com.apple.dock autohide -int 1
# Text
# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Disable Dictation with fn key pressed twice
defaults write com.apple.HIToolbox AppleDictationAutoEnable -int 0
# Keyboard
# When pressing fn/globe by itself, do nothing
defaults write com.apple.HIToolbox AppleFnUsageType -int 0
# command:@, control:^, option:~, shift:$
# Command + L = lock
defaults write -g NSUserKeyEquivalents '{ \
"Lock Screen" = "@L"; \
}'
# Mouse
# Disable Natural Scroll Direction
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
# Disable Look up & data detectors: Tap with three fingers
defaults write com.apple.AppleMultitouchTrackpad ActuateDetents -bool false
# Disable Force Click and haptic feedback: Click then press firmly for Quick Look, Look up, and variable speed media controls.
defaults write NSGlobalDomain com.apple.mouse.forceClick -bool false
defaults write NSGlobalDomain com.apple.trackpad.forceClick -bool false
defaults write com.apple.AppleMultitouchTrackpad ForceSuppressed -bool true
defaults write com.apple.preference.trackpad ForceClickSavedState -bool false
# Bluetooth
# increase audio bitrate
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# iTunes
# Disable iTunes Music
defaults write com.apple.iTunes disableAppleMusic -bool true
# zoom.us
# Disable Dual Screen
defaults write /Library/Preferences/us.zoom.config.plist ZDualMonitorOn -bool false
# Restart UI Elements after Changes
for APP in \
"Activity Monitor" \
"SystemUIServer" \
"Dock" \
"NotificationCenter"
do
killall "${APP}" &> /dev/null
done
EOF
if [[ $(sysctl -in sysctl.proc_translated) = 0 && $(uname -m) != "x86_64" ]]; then
# Intel CPU
# Brew
pushd ${DOTFILE_PATH}/brew
cat taps.txt | xargs brew tap
cat packages.txt | xargs -I {} sh -c "brew list {} || brew install"
cat casks.txt | xargs brew cask install
cat links.txt | xargs brew link --force
popd
else
# Apple Silicon CPU
echo 'Skipped Brew due to Applie Silicon'
fi
fi
link "${DOTFILE_PATH}" "${HOME}/.dotfiles"
mkdir -p ${HOME}/.config/
link "${DOTFILE_PATH}/config/nvim" "${HOME}/.config/nvim"
# Git Config
link "${DOTFILE_PATH}/git/git-dyff" '/usr/local/bin/git-dyff'
link "${DOTFILE_PATH}/git/.gitattributes" "${HOME}/.gitattributes"
link "${DOTFILE_PATH}/git/.gitignore" "${HOME}/.gitignore"
link "${DOTFILE_PATH}/git/.gitconfig" "${HOME}/.gitconfig"
cp -n "${DOTFILE_PATH}/git/.gitcompany.tmpl" "${HOME}/.gitcompany"
mkdir -p ${HOME}/.ssh/
source ${HOME}/.bash_profile
# Install VIM plugins and quit
vim '+PlugInstall' '+qall'