mirror of
https://github.com/Lissy93/dotfiles.git
synced 2025-02-16 06:59:19 +01:00
Adds option for --prompt-before-each
This commit is contained in:
parent
4335c3d82b
commit
9273f4d1d3
@ -19,12 +19,14 @@ WARN_1='\033[1;31m'
|
||||
WARN_2='\033[0;31m'
|
||||
RESET='\033[0m'
|
||||
ITAL='\e[3m'
|
||||
UNDAL='\e[4m'
|
||||
PALE='\e[2m'
|
||||
BOLD='\e[1m'
|
||||
|
||||
PARAMS=$*
|
||||
|
||||
show_help () {
|
||||
echo -e "${PRIMARY_COLOR}🐧 Linux Desktop Preferences${RESET_COLOR}\n"\
|
||||
echo -e "${PRIMARY_COLOR}🐧 Linux Desktop Preferences${RESET}\n"\
|
||||
"${ACCENT_COLOR}This script will apply preferences to the GNOME shell and related applications using dconf\n"\
|
||||
"Config files are read from ./config/gnome and applied to the dconf database in ~/.config/dconf/[user]\n"\
|
||||
"Before any changes are made, existing settings are backed up to ~/.cache/dconf-backups/\n"\
|
||||
@ -47,11 +49,11 @@ fi
|
||||
|
||||
# Ask for user confirmation before proceeding (if skip flag isn't passed)
|
||||
if [[ ! $PARAMS == *"--yes-to-all"* ]]; then
|
||||
echo -e "\n${PRIMARY_COLOR}Would you like to proceed? (y/N)${RESET_COLOR}"
|
||||
echo -e "\n${PRIMARY_COLOR}Would you like to proceed? (y/N)${RESET}"
|
||||
read -t 15 -n 1 -r
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo -e "${ACCENT_COLOR}\nNo worries, nothing will be applied - feel free to come back another time."
|
||||
echo -e "${PRIMARY_COLOR}Exiting...${RESET_COLOR}"
|
||||
echo -e "${PRIMARY_COLOR}Exiting...${RESET}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "\n"
|
||||
@ -86,6 +88,17 @@ apply_dconf () {
|
||||
dconf_key=$1
|
||||
dconf_name=$2
|
||||
|
||||
# If --prompt-before-each flag is set, then ask users permission for each app
|
||||
if [[ $PARAMS == *"--prompt-before-each"* ]]; then
|
||||
echo -e -n "\n${PRIMARY_COLOR}Would you like to apply ${dconf_name} settings? (y/N) ${RESET}"
|
||||
read -t 15 -n 1 -r
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo -e "\n${ACCENT_COLOR}Skipping ${dconf_name} settings${RESET}"
|
||||
return
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
# Check that a valid key is specified
|
||||
if [[ -z "$dconf_key" ]]; then
|
||||
echo -e "${ERROR_COLOR}⚠ Error, no key specified${RESET}"
|
||||
@ -94,7 +107,8 @@ apply_dconf () {
|
||||
|
||||
# Check source file exists
|
||||
if [ ! -f "$DCONF_SOURCE_DIR/$dconf_name.toml" ]; then
|
||||
echo -e "${ERROR_COLOR}⚠ Error, the specified config file for ${dconf_name} doesn't exist in ${DCONF_SOURCE_DIR}${RESET}"
|
||||
echo -e "${ERROR_COLOR}⚠ Error, the specified config file for ${dconf_name}"\
|
||||
"doesn't exist in ${DCONF_SOURCE_DIR}${RESET}"
|
||||
return
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user