-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·190 lines (160 loc) · 4.51 KB
/
install.sh
File metadata and controls
executable file
·190 lines (160 loc) · 4.51 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
source lib.sh
# Only update homebrew every 24h
export HOMEBREW_AUTO_UPDATE_SECS="86400"
# CLI args/options
ARGS=()
DRY_RUN=false
print_usage() {
echo "Usage: install-v2.sh [OPTION]..."
echo ""
echo "Options:"
printf " %-20s print this message and exit\n" "-h, --help"
printf " %-20s outputs the operations that would run, but does not run them\n" "--dry-run"
}
while [[ $# -gt 0 ]]; do
case ${1} in
-h|--help)
print_usage
exit 0
;;
--dry-run)
DRY_RUN=true
;;
*)
ARGS+=("${1}")
;;
esac
shift # past argument or value
done
install_packages() {
info "Installing packages..."
if [ ${DRY_RUN} == true ]; then
skipped "skipping packages"
return 0
fi
case "$(uname -s)" in
Linux)
sudo apt-get -qq update
sudo apt-get -qq install -y \
build-essential \
curl \
fzf \
git \
jq \
mkvtoolnix \
neovim \
pipx \
ripgrep \
stow \
tmux \
tree \
vim \
xclip \
zsh
;;
Darwin)
ensure_homebrew
brew install \
coreutils \
findutils \
fzf \
gnu-tar \
jq \
n \
neovim \
pipx \
ripgrep \
stow \
tmux \
tree \
wezterm \
zsh
brew install --cask \
karabiner-elements \
sensiblesidebuttons
;;
*)
fail "Unsupported OS: $(uname -s)"
exit 1
;;
esac
success "Done installing packages"
}
run_script() {
local script="${1}"
if [ -z "${script}" ]; then
fail "Invalid script: ${script}"
return 1
fi
local msg="running ${script}"
if [ ${DRY_RUN} == true ]; then
skipped "${msg}"
return
fi
info "${msg}"
${script}
if [ ! $? -eq 0 ]; then
fail "${script} failed"
else
success "${script} finished"
fi
}
install_scripts() {
info "Running install scripts..."
find_func=$(which gfind || which find)
for install_script in $(${find_func} scripts/ -type f -executable | sort); do
run_script "${install_script}"
done
success "Done running install scripts"
}
load_gnome_configs() {
# Helpful things
# find keybinds
# gsettings list-recursively | grep -i "'<Super><Alt>"
info "Loading gnome configs"
GNOME_DIR="$(dirname "$0")/gnome"
if [ "$XDG_CURRENT_DESKTOP" != "GNOME" ]; then
fail "Skipping GNOME keybindings: not running GNOME (detected: $XDG_CURRENT_DESKTOP)"
return 0
fi
# media-keys.dconf: Custom keyboard shortcuts (e.g., rofi launcher, app launchers)
dconf load /org/gnome/settings-daemon/plugins/media-keys/ < "$GNOME_DIR/media-keys.dconf"
# wm-keybindings.dconf: Window manager shortcuts (e.g., workspace switching, window movement)
# if keybinds look like org.gnome.desktop.wm.keybindings
dconf load /org/gnome/desktop/wm/keybindings/ < "$GNOME_DIR/wm-keybindings.dconf"
# shell.dconf: GNOME Shell keybindings (e.g., screenshot, overview toggle)
# if keybinds look like org.gnome.shell.keybindings
dconf load /org/gnome/shell/keybindings/ < "$GNOME_DIR/shell.dconf"
# Other keybind options that claude said I may want in the future
# mutter.dconf: Compositor settings (e.g., overlay key, edge tiling)
# dconf load /org/gnome/mutter/ < "$GNOME_DIR/mutter.dconf"
# gtile.dconf: gtile extension configuration for snapping windows
dconf load /org/gnome/shell/extensions/gtile/ < "$GNOME_DIR/gtile.dconf"
}
main() {
info "Setting up dotfiles v2!"
info "Updating submodules"
git submodule init
git submodule update
install_packages
install_scripts
info "Installing dotfiles..."
if ! type stow > /dev/null; then
fail "stow is not installed"
exit 1
fi
if [[ ${DRY_RUN} == true ]]; then
stow --simulate -v .
else
stow -v .
fi
if [ "$(uname -s)" = "Linux" ]; then
load_gnome_configs
fi
success "Done! Great job."
}
main "$@"