This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathyay-hyprland
355 lines (306 loc) · 13.2 KB
/
yay-hyprland
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
#!/bin/bash
# NOTE! IF YOU ADD OR REMOVE PACKAGES, make sure proper spelling as per AUR and official Arch Repo and that are present.
# Adding packages not in AUR or official Arch Repo, this script will fail.
#
# Enjoy!
#
# Here are list of the packages that would be installed
# hyprland- This is the Hyprland compositor
# foot: This is the default terminal
# waybar-hyprland: This is a fork of waybar with Hyprland workspace support
# swaybg: This is used to set a desktop background image
# swww: This is used for wallpaper switcher
# swaylock-effects: This allows for the locking of the desktop its a fork that adds some editional visual effects
# wofi: This is an application launcher menu
# wlogout: This is a logout menu that allows for shutdown, reboot and sleep
# mako: This is a graphical notification daemon
# ttf-jetbrains-mono-nerd : some nerd fonts needed for proper icons in waybar
# otf-font-awesome-4 and otf-font-awesome # necessary for symbols / weather
# ttf-droid - suggested for international fonts to display properly
# ttf-fantasque-sans-mono - a mono font
# polkit-gnome: needed to get superuser access on some graphical appliaction
# python-requests: needed for the weather module script to execute
# grim: This is a screenshot tool it grabs images from a Wayland compositor
# slurp: This helps with screenshots, it selects a region in a Wayland compositor
# viewnior: for photo viewing
# pamixer: This helps with audio settings such as volume
# brightnessctl: used to control monitor bright level
# nwg-look: used to set GTK theme
# xdg-desktop-portal-hyprland: xdg-desktop-portal backend for hyprland
# mpv: Video player and for wofi-beats to work
# qt5ct: for visual settings for qt-apps
# mousepad: simple text editor
# OPTIONAL - packages to be installed. (you will be asked on the script)
# Thunar with necessary plugins
# Bluetooth packages (blueman, bluez, bluez-utils)
# Dracula icons and themes
# Bibata Cursor theme
# Asusctl, Supergfxctl (ASUS ROG laptop stuffs)
# Check if running as root. If root, script will exit
if [[ $EUID -eq 0 ]]; then
echo "This script should not be executed as root! Exiting......."
exit 1
fi
clear
# Set some colors for output messages
OK="$(tput setaf 2)[OK]$(tput sgr0)"
ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)"
NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)"
WARN="$(tput setaf 166)[WARN]$(tput sgr0)"
CAT="$(tput setaf 6)[ACTION]$(tput sgr0)"
ORANGE=$(tput setaf 166)
YELLOW=$(tput setaf 3)
RESET=$(tput sgr0)
# Function to display ASCII art
display_hello() {
cat << "EOF"
_ _ _ _ __ __ _ _ _
| | | | ___| | | ___ \ \ / /__ _ __| | __| | |
| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | |
| _ | __/ | | (_) | \ V V / (_) | | | | (_| |_|
|_| |_|\___|_|_|\___( ) \_/\_/ \___/|_| |_|\__,_(_)
|/
EOF
}
# Display ASCII art
display_hello
# Loop until valid input is provided
while true; do
printf "${WARN} - I stop supporting this install script!!!!!\n\n"
read -p "${NOTE} Please note that I have now moved to a newer install script. Would you like to exit and download the new script? (y/n): " initial_choice
# Check user input
if [[ $initial_choice == "y" || $initial_choice == "Y" ]]; then
echo "Exiting and downloading the new script..."
cd
git clone https://github.com/JaKooLit/Arch-Hyprland.git
cd Arch-Hyprland
chmod +x install.sh
./install.sh
break
elif [[ $initial_choice == "n" || $initial_choice == "N" ]]; then
echo "Continuing to install Arch Hyprland using this script..."
break
else
echo "Invalid choice. Please enter 'y' or 'n'."
fi
done
# Define color variables
GREEN="$(tput setaf 2)[OK]$(tput sgr0)"
RED="$(tput setaf 1)[ERROR]$(tput sgr0)"
YELLOW="$(tput setaf 3)[NOTE]$(tput sgr0)"
CAT="$(tput setaf 6)[ACTION]$(tput sgr0)"
LOG="install-$(date +%d-%H%M%S).log"
# Set the script to exit on error
set -e
printf "$(tput setaf 2) Welcome to the Arch Linux YAY Hyprland installer!\n $(tput sgr0)"
sleep 2
printf "$YELLOW PLEASE BACKUP YOUR FILES BEFORE PROCEEDING!
This script will overwrite some of your configs and files!"
sleep 2
printf "\n
$YELLOW Some commands requires you to enter your password inorder to execute
If you are worried about entering your password, you can cancel the script now with CTRL Q or CTRL C and review contents of this script. \n"
sleep 3
# Check if yay is installed
ISyay=/sbin/yay
if [ -f "$ISyay" ]; then
printf "\n%s - yay was located, moving on.\n" "$GREEN"
else
printf "\n%s - yay was NOT located\n" "$YELLOW"
read -n1 -rep "${CAT} Would you like to install yay (y,n)" INST
if [[ $INST =~ ^[Yy]$ ]]; then
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si --noconfirm 2>&1 | tee -a $LOG
cd ..
else
printf "%s - yay is required for this script, now exiting\n" "$RED"
exit
fi
# update system before proceed
printf "${YELLOW} System Update to avoid issue\n"
yay -Syu --noconfirm 2>&1 | tee -a $LOG
fi
# Prompt user to install packages
# Function to check if a command executed successfully
function check_command_status {
if [ $? -ne 0 ]; then
printf "\nError executing command: %s\n" "$1"
exit 1
fi
}
# Function to print error messages
print_error() {
printf " %s%s\n" "${ERROR}" "$1" "$NC" 2>&1 | tee -a "$LOG"
}
# Function to print success messages
print_success() {
printf "%s%s%s\n" "${OK}" "$1" "$NC" 2>&1 | tee -a "$LOG"
}
# Install necessary packages
read -n1 -rep "${CAT} Would you like to install the packages? (y/n)" inst
echo
if [[ $inst =~ ^[Nn]$ ]]; then
printf "${YELLOW} No packages installed. Goodbye! \n"
exit 1
fi
if [[ $inst =~ ^[Yy]$ ]]; then
read -n1 -rep "${CAT} Would you like to install the Nvidia Hyprland? (NOTE) This will only install hyprland-nvidia. Nvidia drivers wont be installed! (y/n)" inst2
echo
if [[ $inst2 =~ ^[Yy]$ ]]; then
# Install Nvidia Hyprland
if ! yay -S --noconfirm hyprland-nvidia-git 2>&1 | tee -a $LOG; then
print_error "Failed to install Nvidia Hyprland - please check the install.log"
exit 1
fi
else
# Install non-Nvidia Hyprland
printf "${YELLOW} None Nvidia-Hyprland will be installed.\n"
if ! yay -S --noconfirm hyprland 2>&1 | tee -a $LOG; then
print_error " Failed to install Hyprland - please check the install.log."
exit 1
fi
fi
printf "${YELLOW} Installing additional packages. Please wait..."
sleep 1
# Install packages
git_pkgs="waybar"
hypr_pkgs="foot swaybg swaylock-effects wofi wlogout mako xdg-desktop-portal-hyprland grim slurp wl-clipboard polkit-gnome"
font_pkgs="otf-font-awesome ttf-jetbrains-mono-nerd otf-font-awesome-4 ttf-droid ttf-fantasque-sans-mono"
app_pkgs="nwg-look-bin qt5ct btop jq gvfs ffmpegthumbs swww mousepad mpv"
app_pkgs2="python-requests pamixer brightnessctl viewnior pavucontrol playerctl mpv network-manager-applet cava"
if ! yay -S --noconfirm $git_pkgs $hypr_pkgs $font_pkgs $app_pkgs $app_pkgs2 2>&1 | tee -a $LOG; then
print_error " Failed to install additional packages - please check the install.log.\n"
exit 1
fi
echo
print_success " All necessary packages installed successfully."
else
echo
print_error " Packages not installed - please check the install.log."
sleep 2
fi
# additional packages (File Manager)
read -n1 -rep "${CAT} OPTIONAL - Would you like to install Thunar as file manager? (y/n)" inst4
echo
if [[ $inst4 =~ ^[Yy]$ ]]; then
file_pkgs="thunar thunar-volman tumbler"
if ! yay -S --noconfirm $file_pkgs 2>&1 | tee -a $LOG; then
print_error "Failed to install thunar - please check the install.log"
exit 1
cp -r config/xfce4 ~/.config/ || { echo "Error: Failed to copy xfce4 config files."; exit 1; }
cp -r config/Thunar ~/.config/ || { echo "Error: Failed to copy Thunar config files."; exit 1; }
fi
else
printf "${YELLOW} Thunar will not be installed.\n"
fi
# additional packages (themes)
read -n1 -rep "${CAT} OPTIONAL - Would you like to install Dracula Icons and Themes and Bibata Cursor Themes? (y/n)" inst3
echo
if [[ $inst3 =~ ^[Yy]$ ]]; then
theme_pkgs="dracula-gtk-theme dracula-icons-git bibata-cursor-theme-bin"
if ! yay -S --noconfirm $theme_pkgs 2>&1 | tee -a $LOG; then
print_error "Failed to install additional themes- please check the install.log"
exit 1
fi
else
printf "${YELLOW} No additional themes will be installed.\n"
fi
# Clean out other portals
printf "${YELLOW} Clearing any other xdg-desktop-portal implementations...\n"
# Check if packages are installed and uninstall if present
if pacman -Qs xdg-desktop-portal-gnome > /dev/null ; then
echo "Removing xdg-desktop-portal-gnome..."
sudo pacman -R --noconfirm xdg-desktop-portal-gnome 2>&1 | tee -a $LOG
fi
if pacman -Qs xdg-desktop-portal-gtk > /dev/null ; then
echo "Removing xdg-desktop-portal-gtk..."
sudo pacman -R --noconfirm xdg-desktop-portal-gtk 2>&1 | tee -a $LOG
fi
if pacman -Qs xdg-desktop-portal-kde > /dev/null ; then
echo "Removing xdg-desktop-portal-kde..."
sudo pacman -R --noconfirm xdg-desktop-portal-kde 2>&1 | tee -a $LOG
fi
if pacman -Qs xdg-desktop-portal-wlr > /dev/null ; then
echo "Removing xdg-desktop-portal-wlr..."
sudo pacman -R --noconfirm xdg-desktop-portal-wlr 2>&1 | tee -a $LOG
fi
if pacman -Qs xdg-desktop-portal-lxqt > /dev/null ; then
echo "Removing xdg-desktop-portal-lxqt..."
sudo pacman -R --noconfirm xdg-desktop-portal-lxqt 2>&1 | tee -a $LOG
fi
print_success " All other XDG-DESKTOP-PORTAL Implementation Cleared"
### Copy Config Files ###
set -e # Exit immediately if a command exits with a non-zero status.
read -n1 -rep "${CAT} Would you like to copy config and wallpaper files? (y,n)" CFG
if [[ $CFG =~ ^[Yy]$ ]]; then
printf " Copying config files...\n"
mkdir -p ~/.config
cp -r config/hypr ~/.config/ || { echo "Error: Failed to copy hypr config files."; exit 1; }
cp -r config/foot ~/.config/ || { echo "Error: Failed to copy foot config files."; exit 1; }
cp -r config/swaylock ~/.config/ || { echo "Error: Failed to copy swaylock config files."; exit 1; }
cp -r config/wlogout ~/.config/ || { echo "Error: Failed to copy wlogout config files."; exit 1; }
cp -r config/btop ~/.config/ || { echo "Error: Failed to copy btop config files."; exit 1; }
cp -r config/cava ~/.config/ || { echo "Error: Failed to copy cava config files."; exit 1; }
mkdir -p ~/Pictures
cp -r wallpapers ~/Pictures/ || { echo "Error: Failed to copy wallpapers."; exit 1; }
# Set some files as executable
chmod +x ~/.config/hypr/scripts/* 2>&1 | tee -a "$LOG"
else
print_error " No Config files and wallpaper files copied"
fi
# BLUETOOTH
read -n1 -rep "${CAT} OPTIONAL - Would you like to install Bluetooth packages? (y/n)" BLUETOOTH
if [[ $BLUETOOTH =~ ^[Yy]$ ]]; then
printf " Installing Bluetooth Packages...\n"
blue_pkgs="bluez bluez-utils blueman"
if ! yay -S --noconfirm $blue_pkgs 2>&1 | tee -a $LOG; then
print_error "Failed to install bluetooth packages - please check the install.log"
printf " Activating Bluetooth Services...\n"
sudo systemctl enable --now bluetooth.service
sleep 2
fi
else
printf "${YELLOW} No bluetooth packages installed..\n"
fi
### Install software for Asus ROG laptops ###
read -n1 -rep "${CAT} (OPTIONAL - ONLY for ROG Laptops) Would you like to install Asus ROG software support? (y/n)" ROG
if [[ $ROG =~ ^[Yy]$ ]]; then
printf " Installing ASUS ROG packages...\n"
ROG_pkgs="asusctl supergfxctl rog-control-center"
if ! yay -S --noconfirm $ROG_pkgs 2>&1 | tee -a $LOG; then
print_error "Failed to install ROG packages- please check the install.log"
printf " Activating ROG services...\n"
sudo systemctl daemon-reload && sudo systemctl enable --now supergfxd
sleep 2
fi
else
printf "${YELLOW} Asus ROG software support not installed..\n"
fi
### Disable wifi powersave mode ###
read -n1 -rep "${CAT} Would you like to disable wifi powersave? (y,n)" WIFI
if [[ $WIFI =~ ^[Yy]$ ]]; then
LOC="/etc/NetworkManager/conf.d/wifi-powersave.conf"
printf "${YELLOW} The following has been added to $LOC.\n"
printf "[connection]\nwifi.powersave = 2" | sudo tee -a $LOC
printf "\n"
printf "${YELLOW} Restarting NetworkManager service...\n"
sudo systemctl restart NetworkManager
sleep 3
fi
### Script is done ###
printf "\n${GREEN} Installation Completed.\n"
printf "\n${YELLOW} You can start Hyprland by typing Hyprland (note the capital H!).\n"
printf "\n${YELLOW} No Login Manager installed. You can start Hyprland by typing Hyprland (note the capital H!).\n"
printf "\n${YELLOW} It is highly recommended to reboot your computer first.\n"
read -n1 -rep "${CAT} Would you like to start Hyprland now? (y,n)" HYP
if [[ $HYP =~ ^[Yy]$ ]]; then
if command -v Hyprland >/dev/null; then
exec Hyprland
else
print_error " Hyprland not found. Please make sure Hyprland is installed by checking install.log.\n"
exit 1
fi
else
exit
fi