This repository was archived by the owner on Mar 29, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathinstall.sh
More file actions
431 lines (349 loc) · 12 KB
/
install.sh
File metadata and controls
431 lines (349 loc) · 12 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
#!/bin/bash
set -euo pipefail
if [ ! -t 0 ]; then
curl -fsSL -o /tmp/install.sh https://raw.githubusercontent.com/BinaryHarbinger/binarydots/main/install.sh
chmod +x /tmp/install.sh
exec /tmp/install.sh "$@"
fi
# --- Colors ---
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
BLUE=$(tput setaf 4)
RESET=$(tput sgr0)
# --- Get sudo password ---
echo "Enter your sudo password:"
sudo echo
echo -e "${GREEN}➤ Success. ${RESET}"
# --- Dependency check ---
check_dep() {
if ! command -v "$1" >/dev/null 2>&1; then
echo -e "${RED}✖ '$1' is not installed.${RESET}"
return 1
fi
return 0
}
get_distro_normals() {
. /etc/os-release
case "$ID ${ID_LIKE:-}" in
*arch*)
PKG_MANAGER="pacman"
PKG_INSTALL="paru -S --needed"
PKG_UPDATE="paru -Syu"
DISTRO="arch"
;;
*debian* | *ubuntu*)
PKG_MANAGER="apt"
PKG_INSTALL="apt install -y"
PKG_UPDATE="apt update && apt upgrade -y"
DISTRO="debian"
;;
*)
PKG_INSTALL=""
PKG_UPDATE=""
DISTRO="unknown"
echo "Your distro isn't supported. Exiting install"
exit 1
;;
esac
}
get_distro_normals
install_from_repo() {
local app_name="${1:?Usage: install_from_repo <app_name> <owner_name>}"
local owner_name="${2:?Usage: install_from_repo <app_name> <owner_name>}"
local cache_dir="$HOME/.cache"
local url="https://github.com/${owner_name}/${app_name}/releases/latest/download/${app_name}-x86_64"
mkdir -p "$cache_dir"
local tmp_file="$cache_dir/${app_name}-x86_64"
info "Downloading $app_name..."
curl -fL -o "$tmp_file" "$url" || return 1
chmod +x "$tmp_file"
info "Installing to /usr/local/bin/$app_name ..."
sudo mv "$tmp_file" "/usr/local/bin/$app_name"
echo "Done."
}
# --- Gum check & install ---
if ! check_dep gum; then
echo -e "${BLUE}Installing gum...${RESET}"
if [[ "$DISTRO" == "arch" ]]; then
sudo pacman -S --noconfirm gum
else
sudo $PKG_INSTALL gum
fi
if [[ $? -eq 0 ]]; then
echo -e "${GREEN}➤ Installed gum.${RESET}"
else
echo -e "${RED}✖ Failed to install gum. Please install it manually.${RESET}"
exit 1
fi
fi
confirmation() {
local title="$1"
shift
if [ -t 1 ]; then
gum confirm "$title"
else
gum confirm "$title" --selected.background="100" --prompt.foreground="1000"
fi
}
confirmation_alt() {
local title="$1"
shift
if [ -t 1 ]; then
gum confirm "$title"
else
gum confirm "$title" --selected.background="75" --prompt.foreground="1000"
fi
}
info() { gum style --foreground "#49A22C" -- <<<"➤ $1"; }
process() {
local title="$1"
shift
gum spin --spinner dot --title "$title" -- "$@"
}
error() { gum style --foreground "#FF5555" -- <<<"✖ $1"; }
echo -e "${BLUE}
██████╗ ██╗███╗ ██╗ █████╗ ██████╗ ██╗ ██╗██████╗ ██████╗ ████████╗███████╗
██╔══██╗██║████╗ ██║██╔══██╗██╔══██╗╚██╗ ██╔╝██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝
██████╔╝██║██╔██╗ ██║███████║██████╔╝ ╚████╔╝ ██║ ██║██║ ██║ ██║ ███████╗
██╔══██╗██║██║╚██╗██║██╔══██║██╔══██╗ ╚██╔╝ ██║ ██║██║ ██║ ██║ ╚════██║
██████╔╝██║██║ ╚████║██║ ██║██║ ██║ ██║ ██████╔╝╚██████╔╝ ██║ ███████║
╚═════╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝ \n${RESET}"
# Root check for necessary commands
if [[ $EUID -eq 0 ]]; then
error "Please do not run this script as root.\n"
exit 1
fi
echo -e " Binary Harbinger's Hyprland dotfiles\n\n"
confirmation "Proceed with setup?" || exit 0
# --- Update system ---
if check_dep "$PKG_MANAGER"; then
if confirmation "Update system?"; then
info "Updating system..."
($PKG_UPDATE && info "Updated system with no errors") || (error "Failed to update system! Please try manually." && exit 1)
fi
if [[ $DISTRO == "arch" ]] && ! check_dep paru; then
if confirmation "Install paru?"; then
info "Installing dependencies..."
sudo pacman -S --needed base-devel git rust
if [ ! -d "paru" ]; then
process "Cloning paru repository..." git clone https://aur.archlinux.org/paru.git || error "Failed to clone paru"
fi
info "Building package..."
cd paru
makepkg -si
cd ..
rm -rf paru
info "Package (paru) installed."
else
error "Aborting setup."
rm -rf paru
exit 1
fi
fi
fi
# --- Packages ---
PACKAGES=(
breeze nwg-look qt6ct papirus-icon-theme bibata-cursor-theme catppuccin-gtk-theme-mocha
ttf-jetbrains-mono-nerd ttf-jetbrains-mono ttf-fira-code ttf-firacode-nerd otf-fira-code-symbol ttf-material-design-iconic-font ttf-cascadia-mono-nerd noto-fonts-cjk
yazi wiremix fzf
hyprland hyprlock hypridle hyprpolkitagent hyprsunset hyprpicker
power-profiles-daemon udiskie network-manager-applet brightnessctl
cliphist stow git zsh unzip fastfetch pamixer mako foot swww
mpv mpd mpdris2-rs rmpc
base-devel
python-flask python-requests
pcmanfm-qt riftbar-bin ewwii-bin
walker-bin
)
PACKAGES_URL="https://raw.githubusercontent.com/BinaryHarbinger/binarydots/refs/heads/main/${DISTRO^^}_PACKAGES"
# Only replaces if curl succeeds
FETCHED=($(curl -s "$PACKAGES_URL")) && PACKAGES=("${FETCHED[@]}") || true
# --- Install packages ---
if ! $PKG_INSTALL "${PACKAGES[@]}"; then
error "Package installation failed."
exit 1
else
info "Installed packages."
fi
if [[ "$DISTRO" != "arch" ]]; then
install_from_repo riftbar binaryharbinger
fi
if confirmation_alt "Install qutebrowser? (Not Recommended) A keyboard-driven, vim-like browser based on Python and Qt"; then
if $PKG_INSTALL qutebrowser; then
info "Installed qutebrowser."
else
error "Failed to install qutebrowser"
fi
fi
# --- NVIDIA detection & driver installation ---
NVIDIGPU="yes"
if lspci | grep -qi 'NVIDIA'; then
info "NVIDIA GPU detected."
if ! pacman -Qi nvidia-dkms >/dev/null 2>&1; then
process "Installing nvidia-dkms (required for NVIDIA GPUs)..." $PKG_INSTALL nvidia-dkms || error "Failed to install 'nvidia-dkms'. Please install manually"
info "nvidia-dkms installed successfully."
else
info "nvidia-dkms already installed."
fi
else
NVIDIGPU="no"
fi
# --- Clone dotfiles ---
if [ ! -d "./config" ]; then
[ -d "$HOME/Dotfiles.old" ] && rm -rf "$HOME/Dotfiles.old" || true
[ -d "$HOME/Dotfiles" ] && mv ~/Dotfiles ~/Dotfiles.old || true
REPO_URL="https://github.com/BinaryHarbinger/binarydots.git"
PROXY_URL="https://gh-proxy.com/$REPO_URL"
process "Cloning binarydots repository..." git clone "$PROXY_URL" ~/Dotfiles
if [ $? -ne 0 ]; then
echo "Proxy failed, trying direct GitHub clone..."
process "Cloning binarydots repository (direct)..." git clone "$REPO_URL" || {
error "Failed to clone repository."
exit 1
}
fi
process "Cloning mpv configuration repository..." git clone https://github.com/BinaryHarbinger/mpv-dotfiles.git ~/.config/mpv
process "Cloning neovim configuration repository..." git clone https://github.com/BinaryHarbinger/nvim-dotfiles.git ~/.config/nvim
info "Cloned Repository."
else
info "Files already installed."
fi
# --- Link scripts/configs ---
process "Moving scripts and configs..." bash -c '
[ -d "$HOME/dots.old" ] && rm -rf "$HOME/dots.old"
mkdir -p "$HOME/dots.old"
folders=(
"binarydots" "cava" "ewwii" "fastfetch" "foot" "gtk-3.0" "gtk-4.0"
"hypr" "mako" "mpd" "mpv" "pcmanfm-qt" "nwg-look" "qt6ct"
"qutebrowser" "rmpc" "walker" "riftbar" "wiremix" "yazi"
"zsh"
)
for item in "${folders[@]}"; do
src="$HOME/Dotfiles/config/$item"
dest="$HOME/.config/$item"
if [ -d "$dest" ] && [ ! -L "$dest" ]; then
[ -e "$HOME/dots.old/$item" ] && rm -rf "$HOME/dots.old/$item"
mv "$dest" "$HOME/dots.old/" 2>/dev/null || true
elif [ -L "$dest" ]; then
rm "$dest" 2>/dev/null || true
fi
if [ -e "$src" ]; then
ln -s "$src" "$dest"
fi
done
chmod +x \
"$HOME/Dotfiles/bin/"* \
"$HOME/Dotfiles/scripts/"* \
"$HOME/Dotfiles/config/hypr/scripts/"* \
"$HOME/Dotfiles/config/ewwii/scripts/"* \
"$HOME/Dotfiles/config/mako/scripts/"* || true
'
info "Linked scripts and config files."
if [ "$NVIDIGPU" != 'yes' ]; then
if confirmation_alt "Is your main monitor external?"; then
sed -i 's/^env = AQ_DRM_DEVICES,\/dev\/dri\/card0:\/dev\/dri\/card1/#&/' ~/.config/hypr/hyprland.conf
fi
fi
# --- Polkit agent ---
process "Setting up polkit agent..." systemctl --user enable --now hyprpolkitagent.service
if [ $? -eq 0 ]; then
info "Polkit agent set up successfully."
else
error "Failed to enable polkit agent."
fi
# --- MPD services ---
if confirmation_alt "Set up MPD? (Not Recommended for new users)"; then
process "Setting Up MPD" bash -c '
systemctl --user enable mpd
systemctl --user start mpd
'
if [ $? -eq 0 ]; then
info "MPD setup succeeded"
else
error "MPD setup failed"
fi
else
rm -rf ~/.config/rmpc/
rm -rf ~/.config/mpd/
if [ -d "$HOME/dots.old/rmpc" ]; then
cp -r "$HOME/dots.old/rmpc" "$HOME/.config/" >/dev/null 2>&1
fi
if [ -d "$HOME/dots.old/mpd" ]; then
cp -r "$HOME/dots.old/mpd" "$HOME/.config/" >/dev/null 2>&1
fi
fi
# --- Layout update ---
LAYOUT=$(localectl status | awk -F': ' '/X11 Layout/{print $2}')
if [[ -z $LAYOUT ]]; then
error "Could not detect keyboard layout."
else
sed -i "s/kb_layout = tr/kb_layout = ${LAYOUT}/g" "$HOME/.config/hypr/hyprland.conf"
fi
# --- Change shell ---
current_shell=$(getent passwd "$USER" | cut -d: -f7)
if [ "$current_shell" != "/usr/bin/zsh" ] && [ "$current_shell" != "/bin/zsh" ]; then
if confirmation_alt "Change default shell to zsh?"; then
if chsh -s /bin/zsh "$USER"; then
info "Default shell changed to zsh."
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
CUSTOM_PLUGIN_DIR="$HOME/.oh-my-zsh/custom/plugins"
mkdir -p "$CUSTOM_PLUGIN_DIR"
declare -A plugins
plugins=(
[zsh - autosuggestions]="https://github.com/zsh-users/zsh-autosuggestions.git"
[zsh - syntax - highlighting]="https://github.com/zsh-users/zsh-syntax-highlighting.git"
)
# Clone each plugin silently
for plugin in "${!plugins[@]}"; do
PLUGIN_DIR="$CUSTOM_PLUGIN_DIR/$plugin"
if [ ! -d "$PLUGIN_DIR" ]; then
git clone -q "${plugins[$plugin]}" "$PLUGIN_DIR" >/dev/null 2>&1
fi
done
ln -sf ~/Dotfiles/home/.zshrc $HOME/.zshrc
info "Configured ZSH."
if confirmation_alt "Install some rust utils? (Recommended)"; then
if process "Installing rust utilities" $PKG_INSTALL eza sudo-rs bat ripgrep sd fd; then
info "Successfully installed rust utils."
else
error "Failed to install rust utilities."
fi
fi
else
error "Failed to change shell."
fi
fi
fi
# --- Post installation ---
ln -sf "$HOME/.config/hypr/wallpapers/lines.jpg" "$HOME/.config/hypr/wallppr.png"
python ~/.config/hypr/scripts/wallpapers.py changeWallpaper Lines >/dev/null 2>&1 &
disown
if pgrep Hyprland >/dev/null; then
info "Detected Hyprland session."
process "Reloading Components..." bash -c '
pkill waybar >/dev/null 2>&1 & disown
# swww-daemon restart
if pgrep swww-daemon >/dev/null; then
pkill swww-daemon
sleep 0.5
fi
# ewwii restart
if pgrep ewwii >/dev/null; then
killall ewwii
ewwii daemon >/dev/null 2>&1 & disown
for widget in "status" "desktopmusic"; do
ewwii open "$widget" >/dev/null 2>&1 &
done
fi
setsid swww-daemon >/dev/null 2>&1 &
hyprctl reload'
info "Reloaded Components."
fi
# --- Cleanup ---
cd ..
process "Cleaning up..." rm -rf binarydots
info "Cleaned."
$HOME/Dotfiles/bin/change-theme -c Binary >>/dev/null
echo -e "${GREEN}✅ Installation complete!"