-
Notifications
You must be signed in to change notification settings - Fork 144
/
set-hypr
executable file
·392 lines (342 loc) · 12.6 KB
/
set-hypr
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
#!/bin/bash
# HyprV4 By SolDoesTech - https://www.youtube.com/@SolDoesTech
# License..? - You may copy, edit and ditribute this script any way you like, enjoy! :)
# The follwoing will attempt to install all needed packages to run Hyprland
# This is a quick and dirty script there are some error checking
# IMPORTANT - This script is meant to run on a clean fresh Arch install on physical hardware
# Define the software that would be inbstalled
#Need some prep work
prep_stage=(
qt5-wayland
qt5ct
qt6-wayland
qt6ct
qt5-svg
qt5-quickcontrols2
qt5-graphicaleffects
gtk3
polkit-gnome
pipewire
wireplumber
jq
wl-clipboard
cliphist
python-requests
pacman-contrib
)
#software for nvidia GPU only
nvidia_stage=(
linux-headers
nvidia-dkms
nvidia-settings
libva
libva-nvidia-driver-git
)
#the main packages
install_stage=(
kitty
mako
waybar
swww
swaylock-effects
wofi
wlogout
xdg-desktop-portal-hyprland
swappy
grim
slurp
thunar
btop
firefox
thunderbird
mpv
pamixer
pavucontrol
brightnessctl
bluez
bluez-utils
blueman
network-manager-applet
gvfs
thunar-archive-plugin
file-roller
starship
papirus-icon-theme
ttf-jetbrains-mono-nerd
noto-fonts-emoji
lxappearance
xfce4-settings
nwg-look-bin
sddm
)
for str in ${myArray[@]}; do
echo $str
done
# set some colors
CNT="[\e[1;36mNOTE\e[0m]"
COK="[\e[1;32mOK\e[0m]"
CER="[\e[1;31mERROR\e[0m]"
CAT="[\e[1;37mATTENTION\e[0m]"
CWR="[\e[1;35mWARNING\e[0m]"
CAC="[\e[1;33mACTION\e[0m]"
INSTLOG="install.log"
######
# functions go here
# function that would show a progress bar to the user
show_progress() {
while ps | grep $1 &> /dev/null;
do
echo -n "."
sleep 2
done
echo -en "Done!\n"
sleep 2
}
# function that will test for a package and if not found it will attempt to install it
install_software() {
# First lets see if the package is there
if yay -Q $1 &>> /dev/null ; then
echo -e "$COK - $1 is already installed."
else
# no package found so installing
echo -en "$CNT - Now installing $1 ."
yay -S --noconfirm $1 &>> $INSTLOG &
show_progress $!
# test to make sure package installed
if yay -Q $1 &>> /dev/null ; then
echo -e "\e[1A\e[K$COK - $1 was installed."
else
# if this is hit then a package is missing, exit to review log
echo -e "\e[1A\e[K$CER - $1 install had failed, please check the install.log"
exit
fi
fi
}
# clear the screen
clear
# set some expectations for the user
echo -e "$CNT - You are about to execute a script that would attempt to setup Hyprland.
Please note that Hyprland is still in Beta."
sleep 1
# attempt to discover if this is a VM or not
echo -e "$CNT - Checking for Physical or VM..."
ISVM=$(hostnamectl | grep Chassis)
echo -e "Using $ISVM"
if [[ $ISVM == *"vm"* ]]; then
echo -e "$CWR - Please note that VMs are not fully supported and if you try to run this on
a Virtual Machine there is a high chance this will fail."
sleep 1
fi
# let the user know that we will use sudo
echo -e "$CNT - This script will run some commands that require sudo. You will be prompted to enter your password.
If you are worried about entering your password then you may want to review the content of the script."
sleep 1
# give the user an option to exit out
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to continue with the install (y,n) ' CONTINST
if [[ $CONTINST == "Y" || $CONTINST == "y" ]]; then
echo -e "$CNT - Setup starting..."
sudo touch /tmp/hyprv.tmp
else
echo -e "$CNT - This script will now exit, no changes were made to your system."
exit
fi
# find the Nvidia GPU
if lspci -k | grep -A 2 -E "(VGA|3D)" | grep -iq nvidia; then
ISNVIDIA=true
else
ISNVIDIA=false
fi
### Disable wifi powersave mode ###
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to disable WiFi powersave? (y,n) ' WIFI
if [[ $WIFI == "Y" || $WIFI == "y" ]]; then
LOC="/etc/NetworkManager/conf.d/wifi-powersave.conf"
echo -e "$CNT - The following file has been created $LOC.\n"
echo -e "[connection]\nwifi.powersave = 2" | sudo tee -a $LOC &>> $INSTLOG
echo -en "$CNT - Restarting NetworkManager service, Please wait."
sleep 2
sudo systemctl restart NetworkManager &>> $INSTLOG
#wait for services to restore (looking at you DNS)
for i in {1..6}
do
echo -n "."
sleep 1
done
echo -en "Done!\n"
sleep 2
echo -e "\e[1A\e[K$COK - NetworkManager restart completed."
fi
#### Check for package manager ####
if [ ! -f /sbin/yay ]; then
echo -en "$CNT - Configuering yay."
git clone https://aur.archlinux.org/yay.git &>> $INSTLOG
cd yay
makepkg -si --noconfirm &>> ../$INSTLOG &
show_progress $!
if [ -f /sbin/yay ]; then
echo -e "\e[1A\e[K$COK - yay configured"
cd ..
# update the yay database
echo -en "$CNT - Updating yay."
yay -Suy --noconfirm &>> $INSTLOG &
show_progress $!
echo -e "\e[1A\e[K$COK - yay updated."
else
# if this is hit then a package is missing, exit to review log
echo -e "\e[1A\e[K$CER - yay install failed, please check the install.log"
exit
fi
fi
### Install all of the above pacakges ####
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to install the packages? (y,n) ' INST
if [[ $INST == "Y" || $INST == "y" ]]; then
# Prep Stage - Bunch of needed items
echo -e "$CNT - Prep Stage - Installing needed components, this may take a while..."
for SOFTWR in ${prep_stage[@]}; do
install_software $SOFTWR
done
# Setup Nvidia if it was found
if [[ "$ISNVIDIA" == true ]]; then
echo -e "$CNT - Nvidia GPU support setup stage, this may take a while..."
for SOFTWR in ${nvidia_stage[@]}; do
install_software $SOFTWR
done
# update config
sudo sed -i 's/MODULES=()/MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)/' /etc/mkinitcpio.conf
sudo mkinitcpio --config /etc/mkinitcpio.conf --generate /boot/initramfs-custom.img
echo -e "options nvidia-drm modeset=1" | sudo tee -a /etc/modprobe.d/nvidia.conf &>> $INSTLOG
fi
# Install the correct hyprland version
echo -e "$CNT - Installing Hyprland, this may take a while..."
install_software hyprland
# Stage 1 - main components
echo -e "$CNT - Installing main components, this may take a while..."
for SOFTWR in ${install_stage[@]}; do
install_software $SOFTWR
done
# Start the bluetooth service
echo -e "$CNT - Starting the Bluetooth Service..."
sudo systemctl enable --now bluetooth.service &>> $INSTLOG
sleep 2
# Enable the sddm login manager service
echo -e "$CNT - Enabling the SDDM Service..."
sudo systemctl enable sddm &>> $INSTLOG
sleep 2
# Clean out other portals
echo -e "$CNT - Cleaning out conflicting xdg portals..."
yay -R --noconfirm xdg-desktop-portal-gnome xdg-desktop-portal-gtk &>> $INSTLOG
fi
### Copy Config Files ###
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to copy config files? (y,n) ' CFG
if [[ $CFG == "Y" || $CFG == "y" ]]; then
echo -e "$CNT - Copying config files..."
# copy the HyprV directory
cp -R HyprV ~/.config/
#set the measuring unit
echo -e "$CNT - Attempring to set mesuring unit..."
if locale -a | grep -q ^en_US; then
echo -e "$COK - Setting mesuring system to imperial..."
ln -sf ~/.config/HyprV/waybar/conf/mesu-imp.jsonc ~/.config/HyprV/waybar/conf/mesu.jsonc
sed -i 's/SET_MESU=""/SET_MESU="I"/' ~/.config/HyprV/hyprv.conf
else
echo -e "$COK - Setting mesuring system to metric..."
sed -i 's/SET_MESU=""/SET_MESU="M"/' ~/.config/HyprV/hyprv.conf
ln -sf ~/.config/HyprV/waybar/conf/mesu-met.jsonc ~/.config/HyprV/waybar/conf/mesu.jsonc
fi
# Setup each appliaction
# check for existing config folders and backup
for DIR in hypr kitty mako swaylock waybar wlogout wofi
do
DIRPATH=~/.config/$DIR
if [ -d "$DIRPATH" ]; then
echo -e "$CAT - Config for $DIR located, backing up."
mv $DIRPATH $DIRPATH-back &>> $INSTLOG
echo -e "$COK - Backed up $DIR to $DIRPATH-back."
fi
# make new empty folders
mkdir -p $DIRPATH &>> $INSTLOG
done
# link up the config files
echo -e "$CNT - Setting up the new config..."
cp ~/.config/HyprV/hypr/* ~/.config/hypr/
ln -sf ~/.config/HyprV/kitty/kitty.conf ~/.config/kitty/kitty.conf
ln -sf ~/.config/HyprV/mako/conf/config-dark ~/.config/mako/config
ln -sf ~/.config/HyprV/swaylock/config ~/.config/swaylock/config
ln -sf ~/.config/HyprV/waybar/conf/v4-config.jsonc ~/.config/waybar/config.jsonc
ln -sf ~/.config/HyprV/waybar/style/v4-style-dark.css ~/.config/waybar/style.css
ln -sf ~/.config/HyprV/wlogout/layout ~/.config/wlogout/layout
ln -sf ~/.config/HyprV/wofi/config ~/.config/wofi/config
ln -sf ~/.config/HyprV/wofi/style/v4-style-dark.css ~/.config/wofi/style.css
# add the Nvidia env file to the config (if needed)
if [[ "$ISNVIDIA" == true ]]; then
echo -e "\nsource = ~/.config/hypr/env_var_nvidia.conf" >> ~/.config/hypr/hyprland.conf
fi
# Copy the SDDM theme
echo -e "$CNT - Setting up the login screen."
sudo cp -R Extras/sdt /usr/share/sddm/themes/
sudo chown -R $USER:$USER /usr/share/sddm/themes/sdt
sudo mkdir /etc/sddm.conf.d
echo -e "[Theme]\nCurrent=sdt" | sudo tee -a /etc/sddm.conf.d/10-theme.conf &>> $INSTLOG
WLDIR=/usr/share/wayland-sessions
if [ -d "$WLDIR" ]; then
echo -e "$COK - $WLDIR found"
else
echo -e "$CWR - $WLDIR NOT found, creating..."
sudo mkdir $WLDIR
fi
# stage the .desktop file
sudo cp Extras/hyprland.desktop /usr/share/wayland-sessions/
# setup the first look and feel as dark
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita-dark"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Papirus-Dark"
gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark"
gsettings set org.gnome.desktop.interface icon-theme "Papirus-Dark"
cp -f ~/.config/HyprV/backgrounds/v4-background-dark.jpg /usr/share/sddm/themes/sdt/wallpaper.jpg
fi
### Install the starship shell ###
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to activate the starship shell? (y,n) ' STAR
if [[ $STAR == "Y" || $STAR == "y" ]]; then
# install the starship shell
echo -e "$CNT - Hansen Crusher, Engage!"
echo -e "$CNT - Updating .bashrc..."
echo -e '\neval "$(starship init bash)"' >> ~/.bashrc
echo -e "$CNT - copying starship config file to ~/.config ..."
cp Extras/starship.toml ~/.config/
fi
### Install software for Asus ROG laptops ###
read -rep $'[\e[1;33mACTION\e[0m] - For ASUS ROG Laptops - Would you like to install Asus ROG software support? (y,n) ' ROG
if [[ $ROG == "Y" || $ROG == "y" ]]; then
echo -e "$CNT - Adding Keys..."
sudo pacman-key --recv-keys 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
sudo pacman-key --finger 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
sudo pacman-key --lsign-key 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
sudo pacman-key --finger 8F654886F17D497FEFE3DB448B15A6B0E9A3FA35 &>> $INSTLOG
LOC="/etc/pacman.conf"
echo -e "$CNT - Updating $LOC with g14 repo."
echo -e "\n[g14]\nServer = https://arch.asus-linux.org" | sudo tee -a $LOC &>> $INSTLOG
echo -e "$CNT - Update the system..."
sudo pacman -Suy --noconfirm &>> $INSTLOG
echo -e "$CNT - Installing ROG pacakges..."
install_software asusctl
install_software supergfxctl
install_software rog-control-center
echo -e "$CNT - Activating ROG services..."
sudo systemctl enable --now power-profiles-daemon.service &>> $INSTLOG
sleep 2
sudo systemctl enable --now supergfxd &>> $INSTLOG
sleep 2
# add the ROG keybinding file to the config
echo -e "\nsource = ~/.config/hypr/rog-g15-strix-2021-binds.conf" >> ~/.config/hypr/hyprland.conf
fi
### Script is done ###
echo -e "$CNT - Script had completed!"
if [[ "$ISNVIDIA" == true ]]; then
echo -e "$CAT - Since we attempted to setup an Nvidia GPU the script will now end and you should reboot.
Please type 'reboot' at the prompt and hit Enter when ready."
exit
fi
read -rep $'[\e[1;33mACTION\e[0m] - Would you like to start Hyprland now? (y,n) ' HYP
if [[ $HYP == "Y" || $HYP == "y" ]]; then
exec sudo systemctl start sddm &>> $INSTLOG
else
exit
fi