-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (36 loc) · 1.47 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·43 lines (36 loc) · 1.47 KB
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
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "iTerm2 Configuration Installer"
echo "==============================="
echo
# Check if iTerm2 is running
if pgrep -x "iTerm2" > /dev/null; then
echo "⚠️ iTerm2 is running. Please quit iTerm2 first, then re-run this script."
echo " (The preferences file can only be replaced when iTerm2 is not running)"
exit 1
fi
# Install preferences
echo "→ Installing preferences..."
cp "$SCRIPT_DIR/com.googlecode.iterm2.plist" ~/Library/Preferences/com.googlecode.iterm2.plist
echo " ✓ Copied to ~/Library/Preferences/"
# Note: profile.json is included in the plist, so no need to install it separately
# Dynamic Profiles are only needed if installing the profile without the full plist
# Install key bindings
echo "→ Installing key bindings..."
plutil -convert json -o /tmp/keymap.json "$SCRIPT_DIR/key-bindings.itermkeymap"
python3 -c "
import json
with open('/tmp/keymap.json') as f:
data = json.load(f)
mappings = data.get('Key Mappings', {})
with open('/tmp/globalkeymap.json', 'w') as f:
json.dump(mappings, f)
"
# Convert JSON to XML plist format for defaults command
plutil -convert xml1 -o /tmp/globalkeymap.plist /tmp/globalkeymap.json
defaults write com.googlecode.iterm2 GlobalKeyMap "$(cat /tmp/globalkeymap.plist)"
rm /tmp/keymap.json /tmp/globalkeymap.json /tmp/globalkeymap.plist
echo " ✓ Merged GlobalKeyMap into defaults"
echo
echo "✅ Done! Start iTerm2 to use your new configuration."