Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shell scripts more interactive #532

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions tabs/applications-setup/alacritty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,44 @@
. ../common-script.sh

installAlacritty() {
printf "%b\n" "${YELLOW}Installing Alacritty...${RC}"
if ! command_exists alacritty; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
;;
esac
printf "%b" "${YELLOW}Do you want to install Alacritty? (Y/n): ${RC}"
read -r install_choice
if [ "$install_choice" != "n" ]; then
nnyyxxxx marked this conversation as resolved.
Show resolved Hide resolved
printf "%b\n" "${YELLOW}Installing Alacritty...${RC}"
if ! command_exists alacritty; then
case "$PACKAGER" in
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm alacritty
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y alacritty
;;
esac
else
printf "%b\n" "${GREEN}Alacritty is already installed.${RC}"
fi
else
printf "%b\n" "${GREEN}Alacritty is already installed.${RC}"
printf "%b\n" "${GREEN}Skipping Alacritty installation.${RC}"
fi
}

setupAlacrittyConfig() {
printf "%b\n" "${YELLOW}Copy alacritty config files${RC}"
if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
printf "%b" "${YELLOW}Do you want to backup existing configuration files? (Y/n): ${RC}"
read -r backup_choice
if [ "$backup_choice" != "n" ]; then
nnyyxxxx marked this conversation as resolved.
Show resolved Hide resolved
printf "%b\n" "${YELLOW}Backing up existing Alacritty config files...${RC}"
if [ -d "${HOME}/.config/alacritty" ] && [ ! -d "${HOME}/.config/alacritty-bak" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
fi
fi
mkdir -p "${HOME}/.config/alacritty/"
curl -sSLo "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml"
curl -sSLo "${HOME}/.config/alacritty/keybinds.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/keybinds.toml"
curl -sSLo "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml"
printf "%b\n" "${GREEN}Alacritty configuration files copied.${RC}"
printf "%b\n" "${GREEN}Alacritty configuration files backed up.${RC}"
}

checkEnv
checkEscalationTool
installAlacritty
setupAlacrittyConfig
setupAlacrittyConfig
Loading