-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall
executable file
·161 lines (136 loc) · 4.82 KB
/
install
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
#!/usr/bin/env zsh
set -ex
cd "$(dirname "${0:A}")"
# `link foo bar` creates a symlink from `foo` to `bar`.
# Note: this is the opposite of `ln`, which links the
# other direction
function link {
local target=$1
local src=$2
mkdir -p "$(dirname "$target")"
rm -rf "$target"
ln -sf "$src" "$target"
}
############### HOME dotfiles ###############
files=(
bin
haskeline
editrc
vim
vimrc
zsh
zshrc
)
for file in $files; do
link "${HOME}/.${file}" "${PWD}/${file}"
done
############### Other symlinks ###############
find ./man -type f | while read file; do
link "/usr/local/share/${file}" "${PWD}/${file}"
done
link "${HOME}/.config/git" "${PWD}/git"
link "${HOME}/.config/wezterm" "${PWD}/wezterm"
link "${HOME}/.ssh/config" "${PWD}/ssh/config"
mkdir -p ~/.ssh/config.d/
############### Upstream completion scripts ###############
function download_file {
local src=$1
local dest=$2
shift 2
if [[ ! -f $dest ]]; then
mkdir -p "$(dirname $dest)"
curl -o $dest $src "$@"
fi
}
function gh_url {
local repo=$1
local tag=$2
local path=$3
echo "https://raw.githubusercontent.com/${repo}/${tag}/${path}"
}
download_file "$(gh_url 'git/git' 'v2.24.3' 'contrib/completion/git-completion.bash')" ~/.local/bin/git-completion.bash
download_file "$(gh_url 'git/git' 'v2.24.3' 'contrib/completion/git-completion.zsh')" ~/.local/zsh/_git
download_file "$(gh_url 'docker/cli' 'v20.10.2' 'contrib/completion/zsh/_docker')" ~/.local/zsh/_docker
download_file "$(gh_url 'docker/compose' '1.27.4' 'contrib/completion/zsh/_docker-compose')" ~/.local/zsh/_docker-compose
############### Brew dependencies ###############
brew bundle
############### Application settings ###############
# Maccy
defaults write org.p0deje.Maccy pasteByDefault -string '1'
defaults write org.p0deje.Maccy popupPosition -string 'center'
defaults write org.p0deje.Maccy hideFooter -string '1'
defaults write org.p0deje.Maccy hideTitle -string '1'
defaults write org.p0deje.Maccy maxMenuItems -string '10'
defaults write org.p0deje.Maccy KeyboardShortcuts_popup -string '{"carbonModifiers":4096,"carbonKeyCode":9}'
defaults write org.p0deje.Maccy enabledPasteboardTypes -array 'public.utf8-plain-text'
# Rectangle
defaults write com.knollsoft.Rectangle hideMenubarIcon -int 1
defaults write com.knollsoft.Rectangle subsequentExecutionMode -int 2
defaults write com.knollsoft.Rectangle windowSnapping -int 2
rect_disabled_prefs=(
bottomHalf
center
centerThird
firstThird
firstTwoThirds
larger
lastThird
lastTwoThirds
maximizeHeight
nextDisplay
previousDisplay
restore
smaller
topHalf
)
for key in $rect_disabled_prefs; do
defaults write com.knollsoft.Rectangle $key -dict
done
# https://github.com/rxhanson/Rectangle/blob/master/TerminalCommands.md#only-allow-drag-to-snap-when-modifier-keys-are-pressed
rect_modifier_cmd=$(( 1 << 20 ))
rect_modifier_option=$(( 1 << 19 ))
rect_modifier_ctrl=$(( 1 << 18 ))
rect_modifier_shift=$(( 1 << 17 ))
rect_modifier_fn=$(( 1 << 23 ))
rect_key_left=123
rect_key_right=124
rect_key_down=125
rect_key_up=126
defaults write com.knollsoft.Rectangle leftHalf -dict \
keyCode $rect_key_left \
modifierFlags $(( rect_modifier_cmd | rect_modifier_option ))
defaults write com.knollsoft.Rectangle rightHalf -dict \
keyCode $rect_key_right \
modifierFlags $(( rect_modifier_cmd | rect_modifier_option ))
defaults write com.knollsoft.Rectangle maximize -dict \
keyCode $rect_key_up \
modifierFlags $(( rect_modifier_cmd | rect_modifier_option ))
defaults write com.knollsoft.Rectangle topLeft -dict \
keyCode $rect_key_left \
modifierFlags $(( rect_modifier_ctrl | rect_modifier_option ))
defaults write com.knollsoft.Rectangle topRight -dict \
keyCode $rect_key_up \
modifierFlags $(( rect_modifier_ctrl | rect_modifier_option ))
defaults write com.knollsoft.Rectangle bottomLeft -dict \
keyCode $rect_key_down \
modifierFlags $(( rect_modifier_ctrl | rect_modifier_option ))
defaults write com.knollsoft.Rectangle bottomRight -dict \
keyCode $rect_key_right \
modifierFlags $(( rect_modifier_ctrl | rect_modifier_option ))
# Sublime Text
link "${HOME}/Library/Application Support/Sublime Text/Packages/User" "${PWD}/sublime"
############### Application settings ###############
# Keyboard shortcuts
sudo defaults write com.apple.universalaccess com.apple.custommenu.apps -array-add \
NSGlobalDomain \
'com.google.Chrome' \
'com.sublimetext.4'
defaults write NSGlobalDomain NSUserKeyEquivalents -dict-add \
'Hide Others' '@~$h' \
'Minimize' '@$m'
defaults write 'com.google.Chrome' NSUserKeyEquivalents -dict-add \
'Hide Google Chrome' '@^$h'
defaults write 'com.sublimetext.4' NSUserKeyEquivalents -dict-add \
'Hide Sublime Text' '@~h' \
'Larger' '@~$=' \
'Smaller' '@~$-'