Add silent mode
This commit is contained in:
parent
a9f3d168a9
commit
65f4feecbe
4 changed files with 30 additions and 2 deletions
|
@ -42,6 +42,7 @@ usage() {
|
||||||
helpify "--normal, --normalshowapps" "" "Set gnome-shell show apps button style to normal" "Default is bigsur"
|
helpify "--normal, --normalshowapps" "" "Set gnome-shell show apps button style to normal" "Default is bigsur"
|
||||||
helpify "--dialog, --interactive" "" "Run this installer interactively, with dialogs" ""
|
helpify "--dialog, --interactive" "" "Run this installer interactively, with dialogs" ""
|
||||||
helpify "-r, --remove, -u, --uninstall" "" "Remove all installed ${THEME_NAME} themes" ""
|
helpify "-r, --remove, -u, --uninstall" "" "Remove all installed ${THEME_NAME} themes" ""
|
||||||
|
helpify "--silent-mode" "" "Meant for developers: ignore any confirm prompt and params become more strict" ""
|
||||||
helpify "-h, --help" "" "Show this help" ""
|
helpify "-h, --help" "" "Show this help" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +68,12 @@ while [[ $# -gt 0 ]]; do
|
||||||
# Parameters that don't require value
|
# Parameters that don't require value
|
||||||
-r|--remove|-u|-uninstall)
|
-r|--remove|-u|-uninstall)
|
||||||
uninstall='true'; shift ;;
|
uninstall='true'; shift ;;
|
||||||
|
--silent-mode)
|
||||||
|
full_sudo "${1}"; silent_mode='true'; shift ;;
|
||||||
--dialog|--interactive)
|
--dialog|--interactive)
|
||||||
interactive='true'; shift ;;
|
interactive='true'; shift ;;
|
||||||
|
-h|--help)
|
||||||
|
need_help="true"; shift ;;
|
||||||
--normal|--normalshowapps)
|
--normal|--normalshowapps)
|
||||||
showapps_normal="true"; shift ;;
|
showapps_normal="true"; shift ;;
|
||||||
--right|--rightplacement)
|
--right|--rightplacement)
|
||||||
|
@ -77,8 +82,6 @@ while [[ $# -gt 0 ]]; do
|
||||||
max_round="true"; shift ;;
|
max_round="true"; shift ;;
|
||||||
-HD|--highdefinition)
|
-HD|--highdefinition)
|
||||||
compact="false"; shift ;;
|
compact="false"; shift ;;
|
||||||
-h|--help)
|
|
||||||
need_help="true"; shift ;;
|
|
||||||
# Parameters that require value, single use
|
# Parameters that require value, single use
|
||||||
-b|--background)
|
-b|--background)
|
||||||
check_param "${1}" "${1}" "${2}" "must" "must" "must" "false" && shift 2 || shift ;;
|
check_param "${1}" "${1}" "${2}" "must" "must" "must" "false" && shift 2 || shift ;;
|
||||||
|
|
20
lib-core.sh
20
lib-core.sh
|
@ -109,6 +109,7 @@ declare -A need_dialog=([-b]="false" [-s]="false" [-p]="false" [-d]="false" [-n]
|
||||||
need_help="false"
|
need_help="false"
|
||||||
uninstall="false"
|
uninstall="false"
|
||||||
interactive="false"
|
interactive="false"
|
||||||
|
silent_mode="false"
|
||||||
|
|
||||||
no_darken="false"
|
no_darken="false"
|
||||||
no_blur="false"
|
no_blur="false"
|
||||||
|
@ -161,6 +162,8 @@ anim=(
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
start_animation() {
|
start_animation() {
|
||||||
|
[[ "${silent_mode}" == "true" ]] && return 0
|
||||||
|
|
||||||
setterm -cursor off
|
setterm -cursor off
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -181,6 +184,8 @@ start_animation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_animation() {
|
stop_animation() {
|
||||||
|
[[ "${silent_mode}" == "true" ]] && return 0
|
||||||
|
|
||||||
[[ -e "/proc/${ANIM_PID}" ]] && kill -13 "${ANIM_PID}"
|
[[ -e "/proc/${ANIM_PID}" ]] && kill -13 "${ANIM_PID}"
|
||||||
setterm -cursor on
|
setterm -cursor on
|
||||||
}
|
}
|
||||||
|
@ -295,18 +300,27 @@ trap 'signal_abort' INT TERM TSTP
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
ask() {
|
ask() {
|
||||||
|
[[ "${silent_mode}" == "true" ]] && return 0
|
||||||
|
|
||||||
echo -ne "${c_magenta}"
|
echo -ne "${c_magenta}"
|
||||||
read -p " ${2}: " ${1} 2>&1
|
read -p " ${2}: " ${1} 2>&1
|
||||||
echo -ne "${c_default}"
|
echo -ne "${c_default}"
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
|
[[ "${silent_mode}" == "true" ]] && return 0
|
||||||
|
|
||||||
while [[ "${!1}" != "y" && "${!1}" != "n" ]]; do
|
while [[ "${!1}" != "y" && "${!1}" != "n" ]]; do
|
||||||
ask ${1} "${2} (y/n)"
|
ask ${1} "${2} (y/n)"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogify() {
|
dialogify() {
|
||||||
|
if [[ "${silent_mode}" == "true" ]]; then
|
||||||
|
prompt -w "Oops... silent mode has been activated so we can't show the dialog"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
local lists=""
|
local lists=""
|
||||||
local i=0
|
local i=0
|
||||||
local result=""
|
local result=""
|
||||||
|
@ -408,6 +422,12 @@ check_param() {
|
||||||
local has_any_ambiguity_error="false"
|
local has_any_ambiguity_error="false"
|
||||||
local variant_found="false"
|
local variant_found="false"
|
||||||
|
|
||||||
|
if [[ "${silent_mode}" == "true" ]]; then
|
||||||
|
must_not_ambigous="must"
|
||||||
|
must_have_value="must"
|
||||||
|
value_must_found="must"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${has_set["${global_param}"]}" == "true" ]]; then
|
if [[ "${has_set["${global_param}"]}" == "true" ]]; then
|
||||||
need_dialog["${global_param}"]="true"
|
need_dialog["${global_param}"]="true"
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,8 @@ install_beggy_deps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dialog_deps() {
|
install_dialog_deps() {
|
||||||
|
[[ "${silent_mode}" == "true" ]] && return 0
|
||||||
|
|
||||||
if ! has_command dialog; then
|
if ! has_command dialog; then
|
||||||
prompt -w "DEPS: 'dialog' is required for this option."
|
prompt -w "DEPS: 'dialog' is required for this option."
|
||||||
prepare_deps
|
prepare_deps
|
||||||
|
|
|
@ -34,6 +34,7 @@ usage() {
|
||||||
helpify "-p, --panel" "[$(IFS='|'; echo "${PANEL_OPACITY_VARIANTS[*]}")]" "Set '${THEME_NAME}' GDM (GNOME Shell) theme panel transparency" "Default is 15%"
|
helpify "-p, --panel" "[$(IFS='|'; echo "${PANEL_OPACITY_VARIANTS[*]}")]" "Set '${THEME_NAME}' GDM (GNOME Shell) theme panel transparency" "Default is 15%"
|
||||||
helpify "-i, --icon" "[$(IFS='|'; echo "${ICON_VARIANTS[*]}")]" "Set '${THEME_NAME}' GDM (GNOME Shell) 'Activities' icon" "Default is 'standard'"
|
helpify "-i, --icon" "[$(IFS='|'; echo "${ICON_VARIANTS[*]}")]" "Set '${THEME_NAME}' GDM (GNOME Shell) 'Activities' icon" "Default is 'standard'"
|
||||||
helpify "-r, --remove, --revert" "" "Revert to the original themes, do the opposite things of install and connect" ""
|
helpify "-r, --remove, --revert" "" "Revert to the original themes, do the opposite things of install and connect" ""
|
||||||
|
helpify "--silent-mode" "" "Meant for developers: ignore any confirm prompt and params become more strict" ""
|
||||||
helpify "-h, --help" "" "Show this help" ""
|
helpify "-h, --help" "" "Show this help" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +60,8 @@ while [[ $# -gt 0 ]]; do
|
||||||
# Parameters that don't require value
|
# Parameters that don't require value
|
||||||
-r|--remove|--revert)
|
-r|--remove|--revert)
|
||||||
uninstall='true'; shift ;;
|
uninstall='true'; shift ;;
|
||||||
|
--silent-mode)
|
||||||
|
full_sudo "${1}"; silent_mode='true'; shift ;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
need_help="true"; shift ;;
|
need_help="true"; shift ;;
|
||||||
-f|--firefox|-e|--edit-firefox)
|
-f|--firefox|-e|--edit-firefox)
|
||||||
|
|
Loading…
Reference in a new issue