Use variable to store color for script output

This commit is contained in:
clsty
2025-10-01 21:40:06 +08:00
parent 87c031b825
commit 9f711c20e0
9 changed files with 87 additions and 73 deletions
+4 -2
View File
@@ -1,13 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# This script is for quickly generate helpful info # This script is for quickly generate helpful info
# # It should be as independent as possible and should not source other files unless it has to
COLOR_RED='\e[31m'
COLOR_RESET='\e[00m'
cd "$(dirname "$0")";export base="$(pwd)" cd "$(dirname "$0")";export base="$(pwd)"
output_file=diagnose.result;rm $output_file output_file=diagnose.result;rm $output_file
export LANG=C;export LC_ALL=C export LANG=C;export LC_ALL=C
case $(whoami) in case $(whoami) in
root)echo -e "\e[31m[$0]: This script is NOT to be executed with sudo or as root. Aborting...\e[0m";exit 1;; root)echo -e "${COLOR_RED}[$0]: This script is NOT to be executed with sudo or as root. Aborting...${COLOR_RESET}";exit 1;;
esac esac
+3 -3
View File
@@ -13,12 +13,12 @@ set -e
# 0. Before we start # 0. Before we start
source ./scriptdata/install-greeting ;; source ./scriptdata/install-greeting ;;
##################################################################################### #####################################################################################
printf "\e[36m[$0]: 1. Install dependencies\n\e[0m" printf "${COLOR_CYAN}[$0]: 1. Install dependencies\n${COLOR_RESET}"
# TODO: if `--via-nix` is specified, source `install-deps-nix` instead. # TODO: if `--via-nix` is specified, source `install-deps-nix` instead.
source ./scriptdata/install-deps-arch source ./scriptdata/install-deps-arch
##################################################################################### #####################################################################################
printf "\e[36m[$0]: 2. Setup for user groups/services etc\n\e[0m" printf "${COLOR_CYAN}[$0]: 2. Setup for user groups/services etc\n${COLOR_RESET}"
source ./scriptdata/install-setups source ./scriptdata/install-setups
##################################################################################### #####################################################################################
printf "\e[36m[$0]: 3. Copying + Configuring\e[0m\n" printf "${COLOR_CYAN}[$0]: 3. Copying + Configuring\n${COLOR_RESET}"
source ./scriptdata/install-files source ./scriptdata/install-files
+2 -2
View File
@@ -10,7 +10,7 @@ source ./scriptdata/functions
source ./scriptdata/installers source ./scriptdata/installers
prevent_sudo_or_root prevent_sudo_or_root
if command -v pacman >/dev/null 2>&1;then printf "\e[31m[$0]: pacman found, it seems that the system is ArchLinux or Arch-based distro. Aborting...\e[0m\n";exit 1;fi if command -v pacman >/dev/null 2>&1;then printf "${COLOR_RED}[$0]: pacman found, it seems that the system is ArchLinux or Arch-based distro. Aborting...${COLOR_RESET}\n";exit 1;fi
v install-Rubik v install-Rubik
v install-Gabarito v install-Gabarito
v install-OneUI v install-OneUI
@@ -20,5 +20,5 @@ v install-uv
v install-python-packages v install-python-packages
if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then
printf "\n\e[31m[$0]: \!! Important \!! : Please ensure environment variable \e[0m \$ILLOGICAL_IMPULSE_VIRTUAL_ENV \e[31m is set to proper value (by default \"~/.local/state/ags/.venv\"), or AGS config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.\e[0m\n" printf "\n${COLOR_RED}[$0]: \!! Important \!! : Please ensure environment variable ${COLOR_RESET} \$ILLOGICAL_IMPULSE_VIRTUAL_ENV ${COLOR_RED} is set to proper value (by default \"~/.local/state/ags/.venv\"), or AGS config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.${COLOR_RESET}\n"
fi fi
+12
View File
@@ -5,3 +5,15 @@ XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state} XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
BACKUP_DIR=${BACKUP_DIR:-$HOME/backup} BACKUP_DIR=${BACKUP_DIR:-$HOME/backup}
COLOR_RED='\e[00m\e[31m'
COLOR_GREEN='\e[00m\e[32m'
COLOR_YELLOW='\e[00m\e[33m'
COLOR_BLUE='\e[00m\e[34m'
COLOR_PURPLE='\e[00m\e[35m'
COLOR_CYAN='\e[00m\e[36m'
COLOR_RESET='\e[00m'
STYLE_UNDERLINE='\e[4m'
BG_COLOR_CYAN='\e[30m\e[46m'
+21 -21
View File
@@ -8,60 +8,60 @@
function try { "$@" || sleep 0; } function try { "$@" || sleep 0; }
function v() { function v() {
echo -e "####################################################" echo -e "####################################################"
echo -e "\e[34m[$0]: Next command:\e[0m" echo -e "${COLOR_BLUE}[$0]: Next command:${COLOR_RESET}"
echo -e "\e[32m$@\e[0m" echo -e "${COLOR_GREEN}$@${COLOR_RESET}"
execute=true execute=true
if $ask;then if $ask;then
while true;do while true;do
echo -e "\e[34mExecute? \e[0m" echo -e "${COLOR_BLUE}Execute? ${COLOR_RESET}"
echo " y = Yes" echo " y = Yes"
echo " e = Exit now" echo " e = Exit now"
echo " s = Skip this command (NOT recommended - your setup might not work correctly)" echo " s = Skip this command (NOT recommended - your setup might not work correctly)"
echo " yesforall = Yes and don't ask again; NOT recommended unless you really sure" echo " yesforall = Yes and don't ask again; NOT recommended unless you really sure"
read -p "====> " p read -p "====> " p
case $p in case $p in
[yY]) echo -e "\e[34mOK, executing...\e[0m" ;break ;; [yY]) echo -e "${COLOR_BLUE}OK, executing...${COLOR_RESET}" ;break ;;
[eE]) echo -e "\e[34mExiting...\e[0m" ;exit ;break ;; [eE]) echo -e "${COLOR_BLUE}Exiting...${COLOR_RESET}" ;exit ;break ;;
[sS]) echo -e "\e[34mAlright, skipping this one...\e[0m" ;execute=false ;break ;; [sS]) echo -e "${COLOR_BLUE}Alright, skipping this one...${COLOR_RESET}" ;execute=false ;break ;;
"yesforall") echo -e "\e[34mAlright, won't ask again. Executing...\e[0m"; ask=false ;break ;; "yesforall") echo -e "${COLOR_BLUE}Alright, won't ask again. Executing...${COLOR_RESET}"; ask=false ;break ;;
*) echo -e "\e[31mPlease enter [y/e/s/yesforall].\e[0m";; *) echo -e "${COLOR_RED}Please enter [y/e/s/yesforall].${COLOR_RESET}";;
esac esac
done done
fi fi
if $execute;then x "$@";else if $execute;then x "$@";else
echo -e "\e[33m[$0]: Skipped \"$@\"\e[0m" echo -e "${COLOR_YELLOW}[$0]: Skipped \"$@\"${COLOR_RESET}"
fi fi
} }
# When use v() for a defined function, use x() INSIDE its definition to catch errors. # When use v() for a defined function, use x() INSIDE its definition to catch errors.
function x() { function x() {
if "$@";then cmdstatus=0;else cmdstatus=1;fi # 0=normal; 1=failed; 2=failed but ignored if "$@";then cmdstatus=0;else cmdstatus=1;fi # 0=normal; 1=failed; 2=failed but ignored
while [ $cmdstatus == 1 ] ;do while [ $cmdstatus == 1 ] ;do
echo -e "\e[31m[$0]: Command \"\e[32m$@\e[31m\" has failed." echo -e "${COLOR_RED}[$0]: Command \"${COLOR_GREEN}$@${COLOR_RED}\" has failed."
echo -e "You may need to resolve the problem manually BEFORE repeating this command." echo -e "You may need to resolve the problem manually BEFORE repeating this command."
echo -e "[Tip] If a certain package is failing to install, try installing it separately in another terminal.\e[0m" echo -e "[Tip] If a certain package is failing to install, try installing it separately in another terminal.${COLOR_RESET}"
echo " r = Repeat this command (DEFAULT)" echo " r = Repeat this command (DEFAULT)"
echo " e = Exit now" echo " e = Exit now"
echo " i = Ignore this error and continue (your setup might not work correctly)" echo " i = Ignore this error and continue (your setup might not work correctly)"
read -p " [R/e/i]: " p read -p " [R/e/i]: " p
case $p in case $p in
[iI]) echo -e "\e[34mAlright, ignore and continue...\e[0m";cmdstatus=2;; [iI]) echo -e "${COLOR_BLUE}Alright, ignore and continue...${COLOR_RESET}";cmdstatus=2;;
[eE]) echo -e "\e[34mAlright, will exit.\e[0m";break;; [eE]) echo -e "${COLOR_BLUE}Alright, will exit.${COLOR_RESET}";break;;
*) echo -e "\e[34mOK, repeating...\e[0m" *) echo -e "${COLOR_BLUE}OK, repeating...${COLOR_RESET}"
if "$@";then cmdstatus=0;else cmdstatus=1;fi if "$@";then cmdstatus=0;else cmdstatus=1;fi
;; ;;
esac esac
done done
case $cmdstatus in case $cmdstatus in
0) echo -e "\e[34m[$0]: Command \"\e[32m$@\e[34m\" finished.\e[0m";; 0) echo -e "${COLOR_BLUE}[$0]: Command \"${COLOR_GREEN}$@${COLOR_BLUE}\" finished.${COLOR_RESET}";;
1) echo -e "\e[31m[$0]: Command \"\e[32m$@\e[31m\" has failed. Exiting...\e[0m";exit 1;; 1) echo -e "${COLOR_RED}[$0]: Command \"${COLOR_GREEN}$@${COLOR_RED}\" has failed. Exiting...${COLOR_RESET}";exit 1;;
2) echo -e "\e[31m[$0]: Command \"\e[32m$@\e[31m\" has failed but ignored by user.\e[0m";; 2) echo -e "${COLOR_RED}[$0]: Command \"${COLOR_GREEN}$@${COLOR_RED}\" has failed but ignored by user.${COLOR_RESET}";;
esac esac
} }
function showfun() { function showfun() {
echo -e "\e[34m[$0]: The definition of function \"$1\" is as follows:\e[0m" echo -e "${COLOR_BLUE}[$0]: The definition of function \"$1\" is as follows:${COLOR_RESET}"
printf "\e[32m" printf "${COLOR_GREEN}"
type -a $1 type -a $1
printf "\e[97m" printf "${COLOR_RESET}"
} }
function remove_bashcomments_emptylines(){ function remove_bashcomments_emptylines(){
mkdir -p $(dirname $2) mkdir -p $(dirname $2)
@@ -69,6 +69,6 @@ function remove_bashcomments_emptylines(){
} }
function prevent_sudo_or_root(){ function prevent_sudo_or_root(){
case $(whoami) in case $(whoami) in
root) echo -e "\e[31m[$0]: This script is NOT to be executed with sudo or as root. Aborting...\e[0m";exit 1;; root) echo -e "${COLOR_RED}[$0]: This script is NOT to be executed with sudo or as root. Aborting...${COLOR_RESET}";exit 1;;
esac esac
} }
+6 -6
View File
@@ -13,7 +13,7 @@ install-yay() {
} }
handle-deprecated-dependencies (){ handle-deprecated-dependencies (){
printf "\e[36m[$0]: Removing deprecated dependencies:\e[0m\n" printf "${COLOR_CYAN}[$0]: Removing deprecated dependencies:${COLOR_RESET}\n"
for i in illogical-impulse-{microtex,pymyc-aur,ags,agsv1} {hyprutils,hyprpicker,hyprlang,hypridle,hyprland-qt-support,hyprland-qtutils,hyprlock,xdg-desktop-portal-hyprland,hyprcursor,hyprwayland-scanner,hyprland}-git;do try sudo pacman --noconfirm -Rdd $i;done for i in illogical-impulse-{microtex,pymyc-aur,ags,agsv1} {hyprutils,hyprpicker,hyprlang,hypridle,hyprland-qt-support,hyprland-qtutils,hyprlock,xdg-desktop-portal-hyprland,hyprcursor,hyprwayland-scanner,hyprland}-git;do try sudo pacman --noconfirm -Rdd $i;done
# Convert old dependencies to non explicit dependencies so that they can be orphaned if not in meta packages # Convert old dependencies to non explicit dependencies so that they can be orphaned if not in meta packages
remove_bashcomments_emptylines ./scriptdata/previous_dependencies.conf ./cache/old_deps_stripped.conf remove_bashcomments_emptylines ./scriptdata/previous_dependencies.conf ./cache/old_deps_stripped.conf
@@ -31,7 +31,7 @@ handle-deprecated-dependencies (){
##################################################################################### #####################################################################################
if ! command -v pacman >/dev/null 2>&1; then if ! command -v pacman >/dev/null 2>&1; then
printf "\e[31m[$0]: pacman not found, it seems that the system is not ArchLinux or Arch-based distros. Aborting...\e[0m\n" printf "${COLOR_RED}[$0]: pacman not found, it seems that the system is not ArchLinux or Arch-based distros. Aborting...${COLOR_RESET}\n"
exit 1 exit 1
fi fi
@@ -47,7 +47,7 @@ readarray -t pkglist < ./cache/dependencies_stripped.conf
# Use yay. Because paru does not support cleanbuild. # Use yay. Because paru does not support cleanbuild.
# Also see https://wiki.hyprland.org/FAQ/#how-do-i-update # Also see https://wiki.hyprland.org/FAQ/#how-do-i-update
if ! command -v yay >/dev/null 2>&1;then if ! command -v yay >/dev/null 2>&1;then
echo -e "\e[33m[$0]: \"yay\" not found.\e[0m" echo -e "${COLOR_YELLOW}[$0]: \"yay\" not found.${COLOR_RESET}"
showfun install-yay showfun install-yay
v install-yay v install-yay
fi fi
@@ -101,9 +101,9 @@ case $SKIP_PLASMAINTG in
true) sleep 0;; true) sleep 0;;
*) *)
if $ask;then if $ask;then
echo -e "\e[33m[$0]: NOTE: The size of \"plasma-browser-integration\" is about 600 MiB.\e[0m" echo -e "${COLOR_YELLOW}[$0]: NOTE: The size of \"plasma-browser-integration\" is about 600 MiB.${COLOR_RESET}"
echo -e "\e[33mIt is needed if you want playtime of media in Firefox to be shown on the music controls widget.\e[0m" echo -e "${COLOR_YELLOW}It is needed if you want playtime of media in Firefox to be shown on the music controls widget.${COLOR_RESET}"
echo -e "\e[33mInstall it? [y/N]\e[0m" echo -e "${COLOR_YELLOW}Install it? [y/N]${COLOR_RESET}"
read -p "====> " p read -p "====> " p
else else
p=y p=y
+27 -27
View File
@@ -13,14 +13,14 @@ function backup_configs() {
} }
function ask_backup_configs() { function ask_backup_configs() {
printf "\e[31m" printf "${COLOR_RED}"
printf "Would you like to create a backup for \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders?\n[y/N]: " printf "Would you like to create a backup for \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders?\n[y/N]: "
read -p " " backup_confirm read -p " " backup_confirm
case $backup_confirm in case $backup_confirm in
[yY][eE][sS]|[yY]) backup_configs ;; [yY][eE][sS]|[yY]) backup_configs ;;
*) echo "Skipping backup..." ;; *) echo "Skipping backup..." ;;
esac esac
printf "\e[00m" printf "${COLOR_RESET}"
} }
##################################################################################### #####################################################################################
@@ -65,40 +65,40 @@ case $SKIP_HYPRLAND in
v rsync -av --delete --exclude '/custom' --exclude '/hyprlock.conf' --exclude '/hypridle.conf' --exclude '/hyprland.conf' .config/hypr/ "$XDG_CONFIG_HOME"/hypr/ v rsync -av --delete --exclude '/custom' --exclude '/hyprlock.conf' --exclude '/hypridle.conf' --exclude '/hyprland.conf' .config/hypr/ "$XDG_CONFIG_HOME"/hypr/
t="$XDG_CONFIG_HOME/hypr/hyprland.conf" t="$XDG_CONFIG_HOME/hypr/hyprland.conf"
if [ -f $t ];then if [ -f $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" echo -e "${COLOR_BLUE}[$0]: \"$t\" already exists.${COLOR_RESET}"
v mv $t $t.old v mv $t $t.old
v cp -f .config/hypr/hyprland.conf $t v cp -f .config/hypr/hyprland.conf $t
existed_hypr_conf_firstrun=y existed_hypr_conf_firstrun=y
else else
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" echo -e "${COLOR_YELLOW}[$0]: \"$t\" does not exist yet.${COLOR_RESET}"
v cp .config/hypr/hyprland.conf $t v cp .config/hypr/hyprland.conf $t
existed_hypr_conf=n existed_hypr_conf=n
fi fi
t="$XDG_CONFIG_HOME/hypr/hypridle.conf" t="$XDG_CONFIG_HOME/hypr/hypridle.conf"
if [ -f $t ];then if [ -f $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" echo -e "${COLOR_BLUE}[$0]: \"$t\" already exists.${COLOR_RESET}"
v cp -f .config/hypr/hypridle.conf $t.new v cp -f .config/hypr/hypridle.conf $t.new
existed_hypridle_conf=y existed_hypridle_conf=y
else else
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" echo -e "${COLOR_YELLOW}[$0]: \"$t\" does not exist yet.${COLOR_RESET}"
v cp .config/hypr/hypridle.conf $t v cp .config/hypr/hypridle.conf $t
existed_hypridle_conf=n existed_hypridle_conf=n
fi fi
t="$XDG_CONFIG_HOME/hypr/hyprlock.conf" t="$XDG_CONFIG_HOME/hypr/hyprlock.conf"
if [ -f $t ];then if [ -f $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" echo -e "${COLOR_BLUE}[$0]: \"$t\" already exists.${COLOR_RESET}"
v cp -f .config/hypr/hyprlock.conf $t.new v cp -f .config/hypr/hyprlock.conf $t.new
existed_hyprlock_conf=y existed_hyprlock_conf=y
else else
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" echo -e "${COLOR_YELLOW}[$0]: \"$t\" does not exist yet.${COLOR_RESET}"
v cp .config/hypr/hyprlock.conf $t v cp .config/hypr/hyprlock.conf $t
existed_hyprlock_conf=n existed_hyprlock_conf=n
fi fi
t="$XDG_CONFIG_HOME/hypr/custom" t="$XDG_CONFIG_HOME/hypr/custom"
if [ -d $t ];then if [ -d $t ];then
echo -e "\e[34m[$0]: \"$t\" already exists, will not do anything.\e[0m" echo -e "${COLOR_BLUE}[$0]: \"$t\" already exists, will not do anything.${COLOR_RESET}"
else else
echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" echo -e "${COLOR_YELLOW}[$0]: \"$t\" does not exist yet.${COLOR_RESET}"
v rsync -av --delete .config/hypr/custom/ $t/ v rsync -av --delete .config/hypr/custom/ $t/
fi fi
;; ;;
@@ -138,39 +138,39 @@ done
printf "\n" printf "\n"
printf "\n" printf "\n"
printf "\n" printf "\n"
printf "\e[36m[$0]: Finished\e[0m\n" printf "${COLOR_CYAN}[$0]: Finished${COLOR_RESET}\n"
printf "\n" printf "\n"
printf "\e[36mWhen starting Hyprland from your display manager (login screen) \e[30m\e[46m DO NOT SELECT UWSM \e[0m\e[36m\e[0m\n" printf "${COLOR_CYAN}When starting Hyprland from your display manager (login screen) ${COLOR_RED} DO NOT SELECT UWSM ${COLOR_RESET}\n"
printf "\n" printf "\n"
printf "\e[36mIf you are already running Hyprland,\e[0m\n" printf "${COLOR_CYAN}If you are already running Hyprland,${COLOR_RESET}\n"
printf "\e[36mPress \e[30m\e[46m Ctrl+Super+T \e[0m\e[36m to select a wallpaper\e[0m\n" printf "${COLOR_CYAN}Press ${BG_COLOR_CYAN} Ctrl+Super+T ${BG_COLOR_CYAN} to select a wallpaper${COLOR_RESET}\n"
printf "\e[36mPress \e[30m\e[46m Super+/ \e[0m\e[36m for a list of keybinds\e[0m\n" printf "${COLOR_CYAN}Press ${BG_COLOR_CYAN} Super+/ ${COLOR_CYAN} for a list of keybinds${COLOR_RESET}\n"
printf "\n" printf "\n"
printf "\e[36mFor suggestions/hints after installation:\e[0m\n" printf "${COLOR_CYAN}For suggestions/hints after installation:${COLOR_RESET}\n"
printf "\e[36m\e[4m https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/01setup/#post-installation \e[0m\n" printf "${COLOR_CYAN}${STYLE_UNDERLINE} https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/01setup/#post-installation ${COLOR_RESET}\n"
printf "\n" printf "\n"
case $existed_hypr_conf_firstrun in case $existed_hypr_conf_firstrun in
y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before. As it seems it is your first run, we replaced it with a new one. \e[0m\n" y) printf "\n${COLOR_YELLOW}[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before. As it seems it is your first run, we replaced it with a new one. ${COLOR_RESET}\n"
printf "\e[33mAs it seems it is your first run, we replaced it with a new one. The old one has been renamed to \"$XDG_CONFIG_HOME/hypr/hyprland.conf.old\".\e[0m\n" printf "${COLOR_YELLOW}As it seems it is your first run, we replaced it with a new one. The old one has been renamed to \"$XDG_CONFIG_HOME/hypr/hyprland.conf.old\".${COLOR_RESET}\n"
;;esac ;;esac
case $existed_hypr_conf in case $existed_hypr_conf in
y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n" y) printf "\n${COLOR_YELLOW}[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before and we didn't overwrite it. ${COLOR_RESET}\n"
printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n" printf "${COLOR_YELLOW}Please use \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\" as a reference for a proper format.${COLOR_RESET}\n"
;;esac ;;esac
case $existed_hypridle_conf in case $existed_hypridle_conf in
y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hypridle.conf\" already existed before and we didn't overwrite it. \e[0m\n" y) printf "\n${COLOR_YELLOW}[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hypridle.conf\" already existed before and we didn't overwrite it. ${COLOR_RESET}\n"
printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hypridle.conf.new\" as a reference for a proper format.\e[0m\n" printf "${COLOR_YELLOW}Please use \"$XDG_CONFIG_HOME/hypr/hypridle.conf.new\" as a reference for a proper format.${COLOR_RESET}\n"
;;esac ;;esac
case $existed_hyprlock_conf in case $existed_hyprlock_conf in
y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprlock.conf\" already existed before and we didn't overwrite it. \e[0m\n" y) printf "\n${COLOR_YELLOW}[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprlock.conf\" already existed before and we didn't overwrite it. ${COLOR_RESET}\n"
printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprlock.conf.new\" as a reference for a proper format.\e[0m\n" printf "${COLOR_YELLOW}Please use \"$XDG_CONFIG_HOME/hypr/hyprlock.conf.new\" as a reference for a proper format.${COLOR_RESET}\n"
;;esac ;;esac
if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then
printf "\n\e[31m[$0]: \!! Important \!! : Please ensure environment variable \e[0m \$ILLOGICAL_IMPULSE_VIRTUAL_ENV \e[31m is set to proper value (by default \"~/.local/state/quickshell/.venv\"), or Quickshell config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.\e[0m\n" printf "\n${COLOR_RED}[$0]: \!! Important \!! : Please ensure environment variable ${COLOR_RESET} \$ILLOGICAL_IMPULSE_VIRTUAL_ENV ${COLOR_RED} is set to proper value (by default \"~/.local/state/quickshell/.venv\"), or Quickshell config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.${COLOR_RESET}\n"
fi fi
if [[ ! -z "${warn_files[@]}" ]]; then if [[ ! -z "${warn_files[@]}" ]]; then
printf "\n\e[31m[$0]: \!! Important \!! : Please delete \e[0m ${warn_files[*]} \e[31m manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation, or at least take up more space.\e[0m\n" printf "\n${COLOR_RED}[$0]: \!! Important \!! : Please delete ${COLOR_RESET} ${warn_files[*]} ${COLOR_RED} manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation, or at least take up more space.${COLOR_RESET}\n"
fi fi
+7 -7
View File
@@ -3,7 +3,7 @@
##################################################################################### #####################################################################################
printf "\e[34m[$0]: Hi there! Before we start:\n" printf "${COLOR_BLUE}[$0]: Hi there! Before we start:\n"
printf '\n' printf '\n'
printf '[NEW] illogical-impulse is now powered by Quickshell. If you were using the old version with AGS and would like to keep it, do not run this script.\n' printf '[NEW] illogical-impulse is now powered by Quickshell. If you were using the old version with AGS and would like to keep it, do not run this script.\n'
printf ' The AGS version, although uses less memory, has much worse performance (it uses Gtk3). \n' printf ' The AGS version, although uses less memory, has much worse performance (it uses Gtk3). \n'
@@ -11,13 +11,13 @@ printf ' If you aren'\''t running on ewaste, the Quickshell version is reco
printf ' If you would like the AGS version anyway, run the script in its branch instead: git checkout ii-ags && ./install.sh\n' printf ' If you would like the AGS version anyway, run the script in its branch instead: git checkout ii-ags && ./install.sh\n'
printf '\n' printf '\n'
printf 'This script does not handle system-level/hardware stuff like Nvidia drivers.\n' printf 'This script does not handle system-level/hardware stuff like Nvidia drivers.\n'
printf "\e[00m" printf "${COLOR_RESET}"
case $ask in case $ask in
false) sleep 0 ;; false) sleep 0 ;;
*) *)
printf "\e[31m" printf "${COLOR_RED}"
printf '\n' printf '\n'
printf 'Do you want to confirm every time before a command executes?\n' printf 'Do you want to confirm every time before a command executes?\n'
printf ' y = Yes, ask me before executing each of them. (DEFAULT)\n' printf ' y = Yes, ask me before executing each of them. (DEFAULT)\n'
@@ -25,10 +25,10 @@ case $ask in
printf ' a = Abort.\n' printf ' a = Abort.\n'
read -p "====> " p read -p "====> " p
case $p in case $p in
n) ask=false ;; n) ask=false ;;
a) exit 1 ;; a) exit 1 ;;
*) ask=true ;; *) ask=true ;;
esac esac
printf "\e[00m" printf "${COLOR_RESET}"
;; ;;
esac esac
+5 -5
View File
@@ -5,8 +5,8 @@ source ./scriptdata/functions
prevent_sudo_or_root prevent_sudo_or_root
function v() { function v() {
echo -e "[$0]: \e[32mNow executing:\e[0m" echo -e "[$0]: ${COLOR_GREEN}Now executing:${COLOR_RESET}"
echo -e "\e[32m$@\e[0m" echo -e "${COLOR_GREEN}$@${COLOR_RESET}"
"$@" "$@"
} }
@@ -21,7 +21,7 @@ set -e
############################################################################################################################## ##############################################################################################################################
# Undo Step 3: Removing copied config and local folders # Undo Step 3: Removing copied config and local folders
printf '\e[36mRemoving copied config and local folders...\n\e[97m' printf "${COLOR_CYAN}Removing copied config and local folders...\n${COLOR_RESET}"
for i in ags fish fontconfig foot fuzzel hypr mpv wlogout "starship.toml" rubyshot for i in ags fish fontconfig foot fuzzel hypr mpv wlogout "starship.toml" rubyshot
do v rm -rf "$XDG_CONFIG_HOME/$i" do v rm -rf "$XDG_CONFIG_HOME/$i"
@@ -43,7 +43,7 @@ v sudo rm -rf "$XDG_STATE_HOME/ags"
############################################################################################################################## ##############################################################################################################################
# Undo Step 1: Remove added user from video, i2c, and input groups and remove yay packages # Undo Step 1: Remove added user from video, i2c, and input groups and remove yay packages
printf '\e[36mRemoving user from video, i2c, and input groups and removing packages...\n\e[97m' printf "${COLOR_CYAN}Removing user from video, i2c, and input groups and removing packages...\n${COLOR_RESET}"
user=$(whoami) user=$(whoami)
v sudo gpasswd -d "$user" video v sudo gpasswd -d "$user" video
v sudo gpasswd -d "$user" i2c v sudo gpasswd -d "$user" i2c
@@ -56,4 +56,4 @@ read -p "Do you want to uninstall packages used by the dotfiles?\nCtrl+C to exit
# Removing installed yay packages and dependencies # Removing installed yay packages and dependencies
v yay -Rns illogical-impulse-{agsv1,audio,backlight,basic,bibata-modern-classic-bin,fonts-themes,gnome,gtk,hyprland,microtex-git,oneui4-icons-git,portal,python,screencapture,widgets} plasma-browser-integration v yay -Rns illogical-impulse-{agsv1,audio,backlight,basic,bibata-modern-classic-bin,fonts-themes,gnome,gtk,hyprland,microtex-git,oneui4-icons-git,portal,python,screencapture,widgets} plasma-browser-integration
printf '\e[36mUninstall Complete.\n\e[97m' printf "${COLOR_CYAN}Uninstall Complete.\n${COLOR_RESET}"