-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·727 lines (615 loc) · 30.8 KB
/
install.sh
File metadata and controls
executable file
·727 lines (615 loc) · 30.8 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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
#!/bin/bash
# ╔═══════════════════════════════════════════════════════════════════════════════════╗
# ║ ║
# ║ ██╗ ██╗██╗ ██╗██████╗ ██████╗ ██╗ █████╗ ███╗ ██╗██████╗ ║
# ║ ██║ ██║╚██╗ ██╔╝██╔══██╗██╔══██╗██║ ██╔══██╗████╗ ██║██╔══██╗ ║
# ║ ███████║ ╚████╔╝ ██████╔╝██████╔╝██║ ███████║██╔██╗ ██║██║ ██║ ║
# ║ ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══██╗██║ ██╔══██║██║╚██╗██║██║ ██║ ║
# ║ ██║ ██║ ██║ ██║ ██║ ██║███████╗██║ ██║██║ ╚████║██████╔╝ ║
# ║ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ║
# ║ ║
# ║ Premium Configuration Installer ║
# ║ by xscriptor ║
# ║ ║
# ╚═══════════════════════════════════════════════════════════════════════════════════╝
set -e
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ COLORS │
# └───────────────────────────────────────────────────────────────────────────────────┘
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
NC='\033[0m' # No Color
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ VARIABLES │
# └───────────────────────────────────────────────────────────────────────────────────┘
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKUP_DIR="$HOME/.config/hyprland-backup-$(date +%Y%m%d_%H%M%S)"
CONFIG_DIR="$HOME/.config"
LOG_FILE="/tmp/hyprland-install-$(date +%Y%m%d_%H%M%S).log"
INSTALL_GPU_MODE=""
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ HELPER FUNCTIONS │
# └───────────────────────────────────────────────────────────────────────────────────┘
print_banner() {
echo -e "${MAGENTA}"
echo "╔═══════════════════════════════════════════════════════════════╗"
echo "║ HYPRLAND PREMIUM CONFIGURATION INSTALLER ║"
echo "║ by xscriptor ║"
echo "╚═══════════════════════════════════════════════════════════════╝"
echo -e "${NC}"
}
log() {
echo -e "${GREEN}[✓]${NC} $1"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> "$LOG_FILE"
}
warn() {
echo -e "${YELLOW}[!]${NC} $1"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] WARNING: $1" >> "$LOG_FILE"
}
error() {
echo -e "${RED}[✗]${NC} $1"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1" >> "$LOG_FILE"
}
info() {
echo -e "${BLUE}[i]${NC} $1"
}
prompt() {
echo -e "${CYAN}[?]${NC} $1"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ DISTRO DETECTION │
# └───────────────────────────────────────────────────────────────────────────────────┘
detect_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO=$ID
DISTRO_LIKE=$ID_LIKE
elif [ -f /etc/arch-release ]; then
DISTRO="arch"
elif [ -f /etc/fedora-release ]; then
DISTRO="fedora"
elif [ -f /etc/debian_version ]; then
DISTRO="debian"
else
DISTRO="unknown"
fi
log "Detected distribution: $DISTRO"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ GPU DETECTION │
# └───────────────────────────────────────────────────────────────────────────────────┘
detect_gpu() {
GPU_VENDOR="unknown"
NVIDIA_SERIES="unknown"
if lspci | grep -i nvidia &>/dev/null; then
GPU_VENDOR="nvidia"
# Detect NVIDIA series
if lspci | grep -i "RTX 50" &>/dev/null; then
NVIDIA_SERIES="50xx"
elif lspci | grep -i "RTX 40" &>/dev/null; then
NVIDIA_SERIES="40xx"
elif lspci | grep -i "RTX 30" &>/dev/null; then
NVIDIA_SERIES="30xx"
elif lspci | grep -i "RTX 20" &>/dev/null; then
NVIDIA_SERIES="20xx"
elif lspci | grep -i "GTX 16" &>/dev/null; then
NVIDIA_SERIES="16xx"
elif lspci | grep -i "GTX 10" &>/dev/null; then
NVIDIA_SERIES="10xx"
fi
log "Detected NVIDIA GPU (Series: $NVIDIA_SERIES)"
elif lspci | grep -i amd &>/dev/null; then
GPU_VENDOR="amd"
log "Detected AMD GPU"
elif lspci | grep -i intel &>/dev/null; then
GPU_VENDOR="intel"
log "Detected Intel GPU"
fi
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ PACKAGE INSTALLATION │
# └───────────────────────────────────────────────────────────────────────────────────┘
install_packages_arch() {
local packages=("$@")
# Check if yay or paru is available
if command -v paru &>/dev/null; then
AUR_HELPER="paru"
elif command -v yay &>/dev/null; then
AUR_HELPER="yay"
else
warn "No AUR helper found. Installing yay..."
sudo pacman -S --needed --noconfirm git base-devel
git clone https://aur.archlinux.org/yay.git /tmp/yay
cd /tmp/yay && makepkg -si --noconfirm
AUR_HELPER="yay"
fi
log "Installing packages with $AUR_HELPER..."
$AUR_HELPER -S --needed --noconfirm "${packages[@]}"
}
install_packages_fedora() {
local packages=("$@")
log "Installing packages with dnf..."
sudo dnf install -y "${packages[@]}"
}
install_packages_debian() {
local packages=("$@")
log "Installing packages with apt..."
sudo apt update
sudo apt install -y "${packages[@]}"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ CORE PACKAGES │
# └───────────────────────────────────────────────────────────────────────────────────┘
CORE_PACKAGES_ARCH=(
# Hyprland core
"hyprland"
"xdg-desktop-portal-hyprland"
"xdg-desktop-portal-gtk"
"qt5-wayland"
"qt6-wayland"
"qt5ct"
"qt6ct"
"polkit-kde-agent"
"xorg-xwayland"
# Bar and launcher
"waybar"
"rofi-wayland"
"jq"
"imagemagick"
"librsvg"
# Terminal
"kitty"
# Utilities
"awww"
"dunst"
"hyprlock"
"hypridle"
"wlogout"
"grim"
"slurp"
"wl-clipboard"
"cliphist"
"brightnessctl"
"ddcutil"
"pamixer"
"playerctl"
"hyprpicker"
"libnotify"
"iproute2"
"pciutils"
"pavucontrol"
"networkmanager"
"rofi-emoji"
"radeontop"
# System
"pipewire"
"pipewire-alsa"
"pipewire-pulse"
"wireplumber"
"network-manager-applet"
"blueman"
"xdg-utils"
"xdg-user-dirs"
"wget"
"curl"
"gnome-keyring"
"seahorse"
"kwallet5"
"libsecret"
# Fonts
"ttf-jetbrains-mono-nerd"
"noto-fonts"
"noto-fonts-emoji"
# Themes
"adw-gtk3"
"papirus-icon-theme"
"bibata-cursor-theme"
# File manager
"nautilus"
"gvfs"
"gvfs-mtp"
# Other
"jq"
"imagemagick"
"unzip"
)
NVIDIA_PACKAGES_ARCH=(
"nvidia-utils"
"nvidia-settings"
"libva-nvidia-driver"
"egl-wayland"
"envycontrol"
)
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ NVIDIA DRIVER SELECTION │
# └───────────────────────────────────────────────────────────────────────────────────┘
get_nvidia_driver() {
# It is generally safer to use nvidia-dkms for all cards on Wayland to avoid conflicts
# with the open drivers which can still be problematic on some setups.
echo "nvidia-dkms"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ NVIDIA CONFIGURATION │
# └───────────────────────────────────────────────────────────────────────────────────┘
configure_nvidia() {
log "Configuring NVIDIA for Wayland/Hyprland..."
# Get current kernel
KERNEL=$(uname -r | sed 's/-.*//g')
KERNEL_HEADERS="linux-headers"
if [[ $(uname -r) == *"zen"* ]]; then
KERNEL_HEADERS="linux-zen-headers"
elif [[ $(uname -r) == *"lts"* ]]; then
KERNEL_HEADERS="linux-lts-headers"
fi
# Install kernel headers and driver
NVIDIA_DRIVER=$(get_nvidia_driver)
if pacman -Qq "$NVIDIA_DRIVER" >/dev/null 2>&1; then
log "NVIDIA driver ($NVIDIA_DRIVER) is already installed. Skipping driver package."
install_packages_arch "$KERNEL_HEADERS" "${NVIDIA_PACKAGES_ARCH[@]}"
else
log "Installing NVIDIA driver: $NVIDIA_DRIVER"
install_packages_arch "$KERNEL_HEADERS" "$NVIDIA_DRIVER" "${NVIDIA_PACKAGES_ARCH[@]}"
fi
# Configure mkinitcpio
log "Configuring mkinitcpio..."
if [ -f /etc/mkinitcpio.conf ]; then
sudo cp /etc/mkinitcpio.conf /etc/mkinitcpio.conf.backup
# Add NVIDIA modules
if ! grep -q "nvidia nvidia_modeset nvidia_uvm nvidia_drm" /etc/mkinitcpio.conf; then
sudo sed -i 's/^MODULES=(/MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm /' /etc/mkinitcpio.conf
fi
# Regenerate initramfs
sudo mkinitcpio -P
fi
# Configure kernel parameters for GRUB
if command -v grub-mkconfig >/dev/null 2>&1 && [ -f /etc/default/grub ]; then
log "Configuring GRUB kernel parameters..."
sudo cp /etc/default/grub /etc/default/grub.backup
NVIDIA_PARAMS="nvidia_drm.modeset=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1"
if ! grep -q "nvidia_drm.modeset=1" /etc/default/grub; then
sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$NVIDIA_PARAMS /" /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg || warn "grub-mkconfig failed. You may need to update GRUB manually."
fi
elif [ -f /etc/default/grub ]; then
warn "/etc/default/grub found but grub-mkconfig is missing. Skipping GRUB update."
fi
# Configure kernel parameters for systemd-boot
if [ -d /boot/loader/entries ]; then
log "Configuring systemd-boot kernel parameters..."
for entry in /boot/loader/entries/*.conf; do
if [ -f "$entry" ] && ! grep -q "nvidia_drm.modeset=1" "$entry"; then
sudo sed -i '/^options/ s/$/ nvidia_drm.modeset=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1/' "$entry"
fi
done
fi
# Enable NVIDIA power management services
log "Enabling NVIDIA power management services..."
sudo systemctl enable nvidia-suspend.service 2>/dev/null || true
sudo systemctl enable nvidia-hibernate.service 2>/dev/null || true
sudo systemctl enable nvidia-resume.service 2>/dev/null || true
# Blacklist nouveau
log "Blacklisting nouveau driver..."
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
# GPU Mode Script Optional Setup
echo ""
prompt "Enable GPU Performance Mode script (adds sudoers rule for envycontrol)? [Y/n] "
read -r gpu_mode_response
if [[ ! "$gpu_mode_response" =~ ^[Nn]$ ]]; then
INSTALL_GPU_MODE=true
log "Adding sudoers rule for GPU mode (envycontrol)..."
echo "%wheel ALL=(ALL) NOPASSWD: /usr/bin/envycontrol -s *" | sudo tee /etc/sudoers.d/99-gpu-mode > /dev/null
sudo chmod 440 /etc/sudoers.d/99-gpu-mode
else
INSTALL_GPU_MODE=false
log "Skipping GPU mode script installation."
fi
log "NVIDIA configuration complete!"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ BACKUP EXISTING CONFIG │
# └───────────────────────────────────────────────────────────────────────────────────┘
backup_config() {
log "Creating backup of existing configurations..."
mkdir -p "$BACKUP_DIR"
local configs=("hypr" "waybar" "rofi" "wlogout" "kitty" "dunst")
for config in "${configs[@]}"; do
if [ -d "$CONFIG_DIR/$config" ]; then
cp -r "$CONFIG_DIR/$config" "$BACKUP_DIR/"
log "Backed up: $config"
fi
done
log "Backup created at: $BACKUP_DIR"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ INSTALL DOTFILES │
# └───────────────────────────────────────────────────────────────────────────────────┘
install_dotfiles() {
log "Installing dotfiles..."
# Copy Hyprland config
mkdir -p "$CONFIG_DIR/hypr"
cp -r "$SCRIPT_DIR/config/hypr/"* "$CONFIG_DIR/hypr/"
# Copy themes
mkdir -p "$CONFIG_DIR/hypr/themes"
cp -r "$SCRIPT_DIR/themes/"* "$CONFIG_DIR/hypr/themes/"
# Copy scripts
mkdir -p "$CONFIG_DIR/hypr/scripts"
cp -r "$SCRIPT_DIR/scripts/"* "$CONFIG_DIR/hypr/scripts/"
chmod +x "$CONFIG_DIR/hypr/scripts/"*.sh
# Copy wallpapers
mkdir -p "$CONFIG_DIR/hypr/wallpapers"
if [ -d "$SCRIPT_DIR/wallpapers" ] && [ "$(ls -A "$SCRIPT_DIR/wallpapers" 2>/dev/null)" ]; then
cp -r "$SCRIPT_DIR/wallpapers/"* "$CONFIG_DIR/hypr/wallpapers/"
log "Copied $(ls -1 "$SCRIPT_DIR/wallpapers" | wc -l) wallpapers"
fi
# Copy Waybar config
mkdir -p "$CONFIG_DIR/waybar"
cp -r "$SCRIPT_DIR/config/waybar/"* "$CONFIG_DIR/waybar/"
# Copy Rofi config
if [ -d "$SCRIPT_DIR/config/rofi" ]; then
mkdir -p "$CONFIG_DIR/rofi"
cp -r "$SCRIPT_DIR/config/rofi/"* "$CONFIG_DIR/rofi/"
fi
# Copy Wlogout config
if [ -d "$SCRIPT_DIR/config/wlogout" ]; then
mkdir -p "$CONFIG_DIR/wlogout"
cp -r "$SCRIPT_DIR/config/wlogout/"* "$CONFIG_DIR/wlogout/"
fi
# Copy Dunst config
mkdir -p "$CONFIG_DIR/dunst"
cp -r "$SCRIPT_DIR/config/dunst/"* "$CONFIG_DIR/dunst/"
# Copy Hyprlock config (goes to ~/.config/hypr/)
if [ -f "$SCRIPT_DIR/config/hyprlock/hyprlock.conf" ]; then
cp "$SCRIPT_DIR/config/hyprlock/hyprlock.conf" "$CONFIG_DIR/hypr/"
log "Installed hyprlock.conf"
fi
# Copy Hypridle config (goes to ~/.config/hypr/)
if [ -f "$SCRIPT_DIR/config/hypridle/hypridle.conf" ]; then
cp "$SCRIPT_DIR/config/hypridle/hypridle.conf" "$CONFIG_DIR/hypr/"
log "Installed hypridle.conf"
fi
# Clean up GPU mode if user opted out
if [ "$INSTALL_GPU_MODE" = "false" ]; then
rm -f "$CONFIG_DIR/hypr/scripts/gpu-mode.sh"
sed -i '/custom\/gpu-mode/d' "$CONFIG_DIR/waybar/config.jsonc" 2>/dev/null || true
fi
log "Dotfiles installed successfully!"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ INSTALL KITTY WITH CUSTOM CONFIG │
# └───────────────────────────────────────────────────────────────────────────────────┘
install_kitty_config() {
log "Installing Kitty configuration..."
# Copy Kitty config from local
mkdir -p "$CONFIG_DIR/kitty/themes"
if [ -f "$SCRIPT_DIR/config/kitty/kitty.conf" ]; then
cp "$SCRIPT_DIR/config/kitty/kitty.conf" "$CONFIG_DIR/kitty/"
log "Installed kitty.conf"
fi
if [ -d "$SCRIPT_DIR/config/kitty/themes" ]; then
cp -r "$SCRIPT_DIR/config/kitty/themes/"* "$CONFIG_DIR/kitty/themes/"
log "Installed Kitty themes"
fi
# Set default theme
if [ -f "$CONFIG_DIR/kitty/themes/x.conf" ]; then
cp "$CONFIG_DIR/kitty/themes/x.conf" "$CONFIG_DIR/kitty/current-theme.conf"
fi
log "Kitty configuration installed!"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ DOWNLOAD WALLPAPERS │
# └───────────────────────────────────────────────────────────────────────────────────┘
download_wallpapers() {
local WALLPAPER_DIR="$CONFIG_DIR/hypr/wallpapers"
local WALLPAPER_URL="https://github.com/xscriptor/xwall/releases/download/1.0.0/xwall-1.0.0.zip"
local TMP_ZIP="/tmp/xwall-1.0.0.zip"
local TMP_EXTRACT="/tmp/xwall-extract"
echo ""
warn "The full wallpaper pack weighs approximately 1.37 GB."
prompt "Download the complete wallpaper collection? [y/N] "
read -r wall_response
if [[ ! "$wall_response" =~ ^[Yy]$ ]]; then
log "Skipping wallpaper download."
return
fi
log "Downloading wallpaper pack (1.37 GB)... This may take a while."
if ! wget --progress=bar:force -O "$TMP_ZIP" "$WALLPAPER_URL"; then
error "Failed to download wallpaper pack."
rm -f "$TMP_ZIP"
return
fi
log "Extracting wallpapers..."
mkdir -p "$TMP_EXTRACT"
if ! unzip -qo "$TMP_ZIP" -d "$TMP_EXTRACT"; then
error "Failed to extract wallpaper pack."
rm -rf "$TMP_ZIP" "$TMP_EXTRACT"
return
fi
# The zip contains a folder named "xwall-1,0,0" — move its contents into the wallpapers dir
mkdir -p "$WALLPAPER_DIR"
local INNER_DIR
INNER_DIR=$(find "$TMP_EXTRACT" -mindepth 1 -maxdepth 1 -type d | head -n 1)
if [ -n "$INNER_DIR" ] && [ -d "$INNER_DIR" ]; then
cp -r "$INNER_DIR/"* "$WALLPAPER_DIR/"
log "Wallpapers installed to $WALLPAPER_DIR ($(ls -1 "$INNER_DIR" | wc -l) files)"
else
# Fallback: copy everything directly
cp -r "$TMP_EXTRACT/"* "$WALLPAPER_DIR/"
log "Wallpapers installed to $WALLPAPER_DIR"
fi
# Cleanup
rm -rf "$TMP_ZIP" "$TMP_EXTRACT"
log "Wallpaper download complete!"
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ CREATE SCREENSHOTS DIR │
# └───────────────────────────────────────────────────────────────────────────────────┘
create_directories() {
log "Creating necessary directories..."
mkdir -p "$HOME/Pictures/Screenshots"
mkdir -p "$HOME/Pictures/Wallpapers"
}
check_requirements() {
local missing=()
local cmds=(rofi waybar awww notify-send ip lspci)
for c in "${cmds[@]}"; do
if ! command -v "$c" >/dev/null 2>&1; then
missing+=("$c")
fi
done
if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
missing+=("magick/convert")
fi
if [ "${#missing[@]}" -gt 0 ]; then
warn "Some commands are missing: ${missing[*]}"
warn "Wallpapers thumbnails require ImageMagick (magick/convert)."
fi
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ MAIN INSTALLATION │
# └───────────────────────────────────────────────────────────────────────────────────┘
main() {
print_banner
# Check if running as root
if [ "$EUID" -eq 0 ]; then
error "Please do not run this script as root!"
exit 1
fi
# Detect system
detect_distro
detect_gpu
# Show detected info
echo ""
info "Detected Distribution: ${WHITE}$DISTRO${NC}"
info "Detected GPU: ${WHITE}$GPU_VENDOR${NC}"
if [ "$GPU_VENDOR" = "nvidia" ]; then
info "NVIDIA Series: ${WHITE}$NVIDIA_SERIES${NC}"
info "Recommended Driver: ${WHITE}$(get_nvidia_driver)${NC}"
fi
echo ""
# Confirm installation
prompt "This will install Hyprland and its configuration. Continue? [y/N] "
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo "Installation cancelled."
exit 0
fi
# Backup existing config
backup_config
# Install based on distribution
case "$DISTRO" in
arch|endeavouros|manjaro|cachyos|garuda|arcolinux|xos|x)
log "Installing packages for Arch-based system..."
install_packages_arch "${CORE_PACKAGES_ARCH[@]}"
# NVIDIA specific setup
if [ "$GPU_VENDOR" = "nvidia" ]; then
prompt "Configure NVIDIA drivers for Wayland? [Y/n] "
read -r nvidia_response
if [[ ! "$nvidia_response" =~ ^[Nn]$ ]]; then
configure_nvidia
else
INSTALL_GPU_MODE=false
fi
fi
;;
fedora)
warn "Fedora support is experimental. Some packages may not be available."
# Basic packages for Fedora
install_packages_fedora hyprland waybar rofi-wayland kitty dunst wlogout grim slurp wl-clipboard jq imagemagick librsvg2 ddcutil
;;
debian|ubuntu|pop)
error "Debian/Ubuntu requires manual Hyprland installation from source."
error "Please visit: https://wiki.hyprland.org/Getting-Started/Installation/"
exit 1
;;
*)
error "Unsupported distribution: $DISTRO"
exit 1
;;
esac
# Install dotfiles
install_dotfiles
# Download wallpaper pack
download_wallpapers
# Install Kitty config
prompt "Install custom Kitty configuration? [Y/n] "
read -r kitty_response
if [[ ! "$kitty_response" =~ ^[Nn]$ ]]; then
install_kitty_config
fi
# Create directories
create_directories
check_requirements
# Final message
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ INSTALLATION COMPLETE! ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════════════════════════════╝${NC}"
echo ""
info "Configuration backup: $BACKUP_DIR"
info "Installation log: $LOG_FILE"
echo ""
warn "Please reboot your system to apply all changes."
if [ "$GPU_VENDOR" = "nvidia" ]; then
warn "NVIDIA users: Reboot is REQUIRED for driver changes."
fi
echo ""
info "After reboot, select Hyprland from your display manager."
info "Default terminal: SUPER + Return"
info "App launcher: SUPER + D"
info "Theme switcher: SUPER + T"
echo ""
}
# ┌───────────────────────────────────────────────────────────────────────────────────┐
# │ HELP │
# └───────────────────────────────────────────────────────────────────────────────────┘
show_help() {
echo "Hyprland Premium Configuration Installer"
echo ""
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo " -v, --version Show version"
echo " --nvidia-only Only configure NVIDIA (skip other installation)"
echo " --dotfiles-only Only install dotfiles (skip packages)"
echo ""
}
# Parse arguments
case "$1" in
-h|--help)
show_help
exit 0
;;
-v|--version)
echo "Hyprland Premium Config Installer v1.0.0"
exit 0
;;
--nvidia-only)
detect_distro
detect_gpu
if [ "$GPU_VENDOR" = "nvidia" ]; then
configure_nvidia
else
error "No NVIDIA GPU detected!"
exit 1
fi
exit 0
;;
--dotfiles-only)
backup_config
install_dotfiles
create_directories
check_requirements
log "Dotfiles installed!"
exit 0
;;
*)
main
;;
esac