-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
set-hypr.sh
executable file
·170 lines (143 loc) · 5.36 KB
/
set-hypr.sh
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
#!/bin/bash
# Define 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.log"
# Set the script to exit on error
set -e
printf "$(tput setaf 2) Welcome to the Arch Linux 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 require 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
# Function to print error messages
print_error() {
printf " %s%s\n" "$RED" "$1" "$NC" >&2
}
# Function to print success messages
print_success() {
printf "%s%s%s\n" "$GREEN" "$1" "$NC"
}
### Install 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
git_pkgs="grimblast-git hyprpicker-git aylurs-gtk-shell"
hypr_pkgs="hyprland wl-clipboard wf-recorder rofi sddm wlogout dunst swww alacritty hyprcursor hyprlang noto-fonts noto-fonts-emoji"
app_pkgs="nwg-look qt5ct btop jq gvfs ffmpegthumbs mpv playerctl pamixer noise-suppression-for-voice"
app_pkgs2="mate-polkit ffmpeg neovim viewnior pavucontrol thunar ffmpegthumbnailer tumbler thunar-archive-plugin xdg-user-dirs"
theme_pkgs="nordic-theme papirus-icon-theme starship"
# Check for yay or paru
if command -v yay &> /dev/null; then
aur_helper="yay"
elif command -v paru &> /dev/null; then
aur_helper="paru"
else
print_error "Neither yay nor paru found. Please install one of them to continue."
exit 1
fi
if ! $aur_helper -S --noconfirm $git_pkgs $hypr_pkgs $app_pkgs $app_pkgs2 $theme_pkgs 2>&1 | tee -a $LOG; then
print_error " Failed to install additional packages - please check the install.log \n"
exit 1
fi
xdg-user-dirs-update
echo
print_success " All necessary packages installed successfully."
else
echo
print_error " Packages not installed - please check the install.log"
sleep 1
fi
### Copy Config Files ###
read -n1 -rep "${CAT} Would you like to copy config files? (y,n)" CFG
if [[ $CFG =~ ^[Yy]$ ]]; then
printf " Copying config files...\n"
cp -r dotconfig/dunst ~/.config/ 2>&1 | tee -a $LOG
cp -r dotconfig/hypr ~/.config/ 2>&1 | tee -a $LOG
cp -r dotconfig/kitty ~/.config/ 2>&1 | tee -a $LOG
cp -r dotconfig/pipewire ~/.config/ 2>&1 | tee -a $LOG
cp -r dotconfig/rofi ~/.config/ 2>&1 | tee -a $LOG
cp -r dotconfig/wlogout ~/.config/ 2>&1 | tee -a $LOG
# Set some files as exacutable
chmod +x ~/.config/hypr/xdg-portal-hyprland
fi
FONT_DIR="$HOME/.local/share/fonts"
FONT_ZIP="$FONT_DIR/Meslo.zip"
FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip"
# Check if Meslo Nerd-font is already installed
if fc-list | grep -qi "Meslo"; then
echo "Meslo Nerd-fonts are already installed."
exit 0
fi
echo "Installing Meslo Nerd-fonts..."
# Create the fonts directory if it doesn't exist
mkdir -p "$FONT_DIR"
# Download the font zip file if it doesn't already exist
if [ ! -f "$FONT_ZIP" ]; then
wget -O "$FONT_ZIP" "$FONT_URL" || {
echo "Failed to download Meslo Nerd-fonts from $FONT_URL"
exit 1
}
else
echo "Meslo.zip already exists in $FONT_DIR, skipping download."
fi
if [ ! -d "$FONT_DIR/Meslo" ]; then
unzip -o "$FONT_ZIP" -d "$FONT_DIR" || {
echo "Failed to unzip $FONT_ZIP"
exit 1
}
else
echo "Meslo font files already unzipped in $FONT_DIR, skipping unzip."
fi
rm "$FONT_ZIP"
fc-cache -fv # Rebuild the font cache
echo "Meslo Nerd-fonts installed successfully"
### Enable SDDM Autologin ###
read -n1 -rep 'Would you like to enable SDDM autologin? (y,n)' SDDM
if [[ $SDDM == "Y" || $SDDM == "y" ]]; then
LOC="/etc/sddm.conf"
echo -e "The following has been added to $LOC.\n"
echo -e "[Autologin]\nUser = $(whoami)\nSession=hyprland" | sudo tee -a $LOC
echo -e "\n"
echo -e "Enabling SDDM service...\n"
sudo systemctl enable sddm
sleep 3
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
### Script is done ###
printf "\n${GREEN} Installation Completed.\n"
echo -e "${GREEN} You can start Hyprland by typing Hyprland (note the capital H).\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