-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetPreferences.zsh
executable file
·87 lines (68 loc) · 3.28 KB
/
setPreferences.zsh
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
# Make sure that .zshrc file exists, as we may add things to it
if ! [ -f "$HOME/.zshrc" ]; then
touch "$HOME/.zshrc"
fi
# Tell .zshrc to source a file that has my ZShell Preferences
shellPreferences="source \"$(find ~+ -type f -name 'shellPreferences.zsh')\""
if ! grep -q "$shellPreferences" "$HOME/.zshrc"
then
echo $shellPreferences >> "$HOME/.zshrc"
fi
# Set up my tmux config
if [ ! -e "$HOME/.config/tmux/tmux.conf" ]
then
git clone "https://github.com/dante0624/tmux_config" "$HOME/.config/tmux/"
fi
# Set up my neovim config
if [ ! -e "$HOME/.config/nvim/init.lua" ]
then
git clone "https://github.com/dante0624/nvim_config" "$HOME/.config/nvim/"
fi
# Make nvim the default editor for git
git config --global core.editor "nvim"
# Create a soft link for my intelliJ vim config
ideavimPreferences=$(find ~+ -type f -name "ideavim.vim")
ln -sf $ideavimPreferences "$HOME/.ideavimrc"
# Ovwrite several preferences, saved as Plists at ~/Library/Preferences/
# Some preferences we are overwritting also have a GUI found at:
# 1. System Settings -> Keyboard -> Keyboard Shortcuts
# 2. In the application itself (application menu bar -> settings)
# First change general Mac Settings
# Need to restart computer for changes to be seen
# Modify Keyboard Shortcuts -> App Shortcuts -> All Applications
globalPreferences=$(find ~+ -type f -name "globalPreferences.xml")
cp $globalPreferences globalBinary
plutil -convert binary1 globalBinary
mv globalBinary ~/Library/Preferences/.GlobalPreferences.plist
# Modify Keyboard Shortcuts -> (LaunchPad & Doc, Mission Control)
hotKeys=$(find ~+ -type f -name "hotKeys.xml")
cp $hotKeys hotKeysBinary
plutil -convert binary1 hotKeysBinary
mv hotKeysBinary ~/Library/Preferences/com.apple.symbolichotkeys.plist
# Set iTerm Preferences
# This shell script must be called from something other than iterm itself!!!
itermPreferences=$(find ~+ -type f -name "itermPreferences.xml")
cp $itermPreferences itermBinary
plutil -convert binary1 itermBinary
mv itermBinary ~/Library/Preferences/com.googlecode.iterm2.plist
# Iterm keeps its prefernces in RAM and when you close iTerm they get written
# So if you open iTerm, run this script, then close iTerm it will:
# 1. loads the default settings from the hard drive into RAM
# 2. A user runs the script, which updates only the hard drive
# 3. iTerm closes and saves the default settings back onto the hard drive
# Set Amethyst preferences
amethystPreferences=$(find ~+ -type f -name "amethystPreferences.xml")
cp $amethystPreferences amethystBinary
plutil -convert binary1 amethystBinary
mv amethystBinary ~/Library/Preferences/com.amethyst.Amethyst.plist
# Modify misc mac settings
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock mru-spaces -bool false
defaults write com.apple.dock expose-group-apps -bool false
defaults write com.apple.spaces spans-displays -bool true
defaults write com.apple.WindowManager EnableStandardClickToShowDesktop -bool false
# Copy Launch Agents to the correct destination, so they begin on startup
amethystAgent=$(find ~+ -type f -name "startAmethyst.xml")
cp $amethystAgent ~/Library/LaunchAgents/personal.startAmethyst.plist
swapEscAndCapsLockAgent=$(find ~+ -type f -name "swapEscAndCapsLock.xml")
cp $swapEscAndCapsLockAgent ~/Library/LaunchAgents/personal.swapEscAndCapsLock.plist