-
Notifications
You must be signed in to change notification settings - Fork 24
/
install.sh
executable file
·42 lines (37 loc) · 1.25 KB
/
install.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
#!/usr/bin/env bash
OSX_VERSION="$(sw_vers -productVersion | sed -E "s/^[0-9]+\.([0-9]+)/\\1/")"
# Install Karabiner if it isn't installed, but homebrew and cask are.
if [[ "$(type -P brew)" && "$(brew tap | awk '/cask/')" ]]; then
if [[ ! "$(brew cask list 2>/dev/null | grep karabiner)" ]]; then
echo "Installing Karabiner..."
if [[ $OSX_VERSION -ge 12 ]]; then
brew cask install karabiner-elements
else
brew cask install karabiner
fi
fi
echo "Karabiner installed."
else
echo "Homebrew and Homebrew Cask not detected. Not installing Karabiner."
echo "If you intended for this script to install Karabiner, install"
echo "Homebrew and Homebrew Cask:"
echo
echo "http://brew.sh/"
echo "http://caskroom.io/"
echo
fi
# Copy Karabiner settings.
echo "Copying Karabiner settings..."
if [[ $OSX_VERSION -ge 12 ]]; then
mkdir -p ~/.karabiner.d/configuration
cp karabiner.json ~/.karabiner.d/configuration/karabiner.json
else
mkdir -p ~/Library/Application\ Support/Karabiner
cp private.xml ~/Library/Application\ Support/Karabiner/private.xml
fi
# Copy DefaultKeyBinding.dict
mkdir -p ~/Library/KeyBindings
echo "Copying DefaultKeyBinding.dict..."
cp DefaultKeyBinding.dict ~/Library/KeyBindings/DefaultKeyBinding.dict
echo
echo "Done."