-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·186 lines (149 loc) · 5.95 KB
/
install
File metadata and controls
executable file
·186 lines (149 loc) · 5.95 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
#!/bin/bash
# Dotfiles & Hyprland Rice Installation Script
# Created & Maintained by exvorn (Jovan Bogovac)
# https://github.com/exvorn/dotfiles
#
# This script automates setting up your Linux compositor and CLI/program configurations.
# It installs essential packages, dotfiles, themes, wallpaper, and customizations
# for Hyprland, terminal tools, and other programs - for a minimal, beautiful, and efficient workflow.
# Exit the script on any error
set -euo pipefail
trap 'echo "[-] An unexpected error occurred!" >&2' ERR
BASEDIR="$(dirname "$(readlink -f "$0")")"
# Check if the basedir contains valid data
if [ ! -f "$BASEDIR/.zshrc" ] ||
[ ! -f "$BASEDIR/.tmux.conf" ] ||
[ ! -d "$BASEDIR/.config" ] ||
[ ! -d "$BASEDIR/.config/Code" ] ||
[ ! -d "$BASEDIR/.config/hypr" ] ||
[ ! -d "$BASEDIR/.config/kitty" ] ||
[ ! -d "$BASEDIR/.config/mako" ] ||
[ ! -d "$BASEDIR/.config/nvim" ] ||
[ ! -d "$BASEDIR/.config/swappy" ] ||
[ ! -d "$BASEDIR/.config/waybar" ] ||
[ ! -d "$BASEDIR/.config/wofi" ]; then
echo '[-] Missing required data. Aborting...'
exit 1
fi
show_help() {
echo "Dotfiles & Hyprland Rice Installation Script
Automates setup for your Linux compositor, terminal, and program configurations.
Usage:
$0 [OPTION]
Options:
--packages Install recommended packages for ricing and productivity
--dotfiles Install dotfiles and configs (Hyprland, terminal, etc.)
--all Run everything
--help Show this help message
Example:
$0 --all
Notes:
- This script may overwrite existing configs!
- Your existing dotfiles and configs will be backed up in ~/.dotfiles-backup/YYYYMMDDHHMMSS
- Review the script before running if you have custom settings.
- Run as your normal user, not root (unless prompted for sudo).
Let's get your window manager and tools looking awesome!"
exit 0
}
install_packages() {
echo -e '[+] Installing essential packages...\n'
local packages=(
linux-firmware sof-firmware networkmanager alsa-utils pipewire pipewire-pulse pavucontrol
hyprland hyprpaper hyprlock hypridle waybar kitty zsh wofi ly wl-clipboard thunar cmatrix
mako brightnessctl cronie neovim tmux lsd slurp grim imagemagick swappy wireplumber
xdg-desktop-portal-hyprland ttf-jetbrains-mono ttf-hack ttf-dejavu ttf-liberation htop
firefox-developer-edition chromium git python noto-fonts noto-fonts-cjk noto-fonts-emoji
)
sudo pacman -S --needed --noconfirm "${packages[@]}"
# Oh-My-Zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
# Python Virtual Environment
python -m venv ~/venv
# Vim-Plug
if [ ! -f "$HOME/.local/share/nvim/site/autoload/plug.vim" ]; then
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# Paru (only if not installed)
if ! command -v paru >/dev/null 2>&1; then
local local_src_path="$HOME/.local/src"
mkdir -p "$local_src_path"
git clone https://aur.archlinux.org/paru.git "$local_src_path/paru"
(cd "$local_src_path/paru" && makepkg -si)
fi
# Visual Studio Code
if ! pacman -Q visual-studio-code-bin >/dev/null 2>&1; then
paru -S --noconfirm visual-studio-code-bin
fi
echo -e '\n[+] Successfully installed all necessary packages.\n'
echo -e '[+] Enabling and starting systemd services...'
local system_services=(
NetworkManager ly cronie
)
local user_services=(
pipewire pipewire-pulse wireplumber
xdg-desktop-portal xdg-desktop-portal-hyprland
)
sudo systemctl enable --now "${system_services[@]}"
systemctl --user enable --now "${user_services[@]}"
echo -e '[+] Services enabled and started successfully.\n'
}
install_dotfiles() {
local backup_dir="$HOME/.dotfiles-backup/dotfiles-$(date +%Y%m%d%H%M%S)"
mkdir -p "$backup_dir"
echo "[+] Backing up your current config files to '$backup_dir'"
local managed_items=(
"$HOME/.zshrc"
"$HOME/.tmux.conf"
"$HOME/.config/hypr"
"$HOME/.config/kitty"
"$HOME/.config/mako"
"$HOME/.config/nvim"
"$HOME/.config/swappy"
"$HOME/.config/waybar"
"$HOME/.config/wofi"
"$HOME/.config/Code"
)
for item in "${managed_items[@]}"; do
if [ -e "$item" ]; then
mkdir -p "$backup_dir/$(dirname "${item#$HOME/}")"
cp -r "$item" "$backup_dir/$(dirname "${item#$HOME/}")"
fi
done
echo -e '[+] Backup complete.\n'
echo -e '[+] Copying dotfiles and configs...\n'
# Copy dotfiles
cp -rf "$BASEDIR/.zshrc" "$BASEDIR/.tmux.conf" "$BASEDIR/.config" "$HOME"
# Make all custom Hyprland scripts in ~/.config/hypr/scripts executable
chmod +x "$HOME"/.config/hypr/scripts/*
# Add battery-alert cronjob
CRON="*/2 * * * * $HOME/.config/hypr/scripts/battery-alert"
(crontab -l 2>/dev/null | grep -v "$HOME/.config/hypr/scripts/battery-alert" || true; echo "$CRON") | crontab -
# Visual Studio Code extensions
local vscode_extensions=(github.copilot github.copilot-chat zhuangtongfa.material-theme)
if command -v code >/dev/null 2>&1; then
for ext in "${vscode_extensions[@]}"; do
code --install-extension "$ext" --force
done
else
echo "[-] VS Code's 'code' command not found. Skipping extension installation." >&2
fi
# Install NeoVim Plugins
nvim +PlugInstall +qall
echo -e '\n[+] Successfully copied all dotfiles and configs.'
}
install_all() {
echo '[+] Installing Rice...'
install_packages
install_dotfiles
echo -e '\n[+] Successfully riced your system; reboot && enjoy :D'
}
arg="${1:---help}"
case "$arg" in
--packages) install_packages ;;
--dotfiles) install_dotfiles ;;
--all) install_all ;;
--help|*) show_help ;;
esac