Improve stability

This commit is contained in:
Muhammad Rivan 2021-06-13 21:47:00 +07:00
parent 2521e7ecb3
commit 22bc88823a
No known key found for this signature in database
GPG key ID: C56A200FD936FAAA
3 changed files with 42 additions and 39 deletions

View file

@ -143,7 +143,7 @@ else
# rm -rf "${THEME_SRC_DIR}/sass/_gtk-base-temp.scss" # rm -rf "${THEME_SRC_DIR}/sass/_gtk-base-temp.scss"
if is_my_distro "arch" && has_command xfce4-session; then if (is_my_distro "arch" || is_my_distro "void") && has_command xfce4-session; then
msg="XFCE: you may need to logout after changing your theme to fix your panel opacity." msg="XFCE: you may need to logout after changing your theme to fix your panel opacity."
notif_msg="${msg}\n\n${final_msg}" notif_msg="${msg}\n\n${final_msg}"

View file

@ -667,18 +667,21 @@ full_sudo() {
} }
get_http_response() { get_http_response() {
exec 3<> "/dev/tcp/${1}/80" if exec 3<> "/dev/tcp/${1}/80"; then
echo -e "GET / HTTP/1.1\nHost: ${1}\n\n" >&3 echo -e "GET / HTTP/1.1\nHost: ${1}\n\n" >&3
( (
IFS="" IFS=""
while read -r -t 1 line 0<&3; do while read -r -t 1 line 0<&3; do
echo "${line//$"\r"}" echo "${line//$"\r"}"
done done
) )
exec 3<&- exec 3<&-; return 0
else
exec 3<&-; return 1
fi
} }
usage() { usage() {

View file

@ -43,6 +43,8 @@ usage() {
#-----------------------------PARSE ARGUMENTS---------------------------------# #-----------------------------PARSE ARGUMENTS---------------------------------#
echo
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
# Don't show any dialog here. Let this loop checks for errors or shows help # Don't show any dialog here. Let this loop checks for errors or shows help
# We can only show dialogs when there's no error and no -r parameter # We can only show dialogs when there's no error and no -r parameter
@ -140,85 +142,83 @@ if [[ "${uninstall}" == 'true' ]]; then
prompt -w "REMOVAL: Non file-related parameters will be ignored." prompt -w "REMOVAL: Non file-related parameters will be ignored."
if [[ "${gdm}" == 'true' ]]; then if [[ "${gdm}" == 'true' ]]; then
echo; prompt -i "Removing '${name}' GDM theme..." prompt -i "Removing '${name}' GDM theme..."
revert_gdm_theme revert_gdm_theme
echo; prompt -s "Done! '${name}' GDM theme has been removed." prompt -s "Done! '${name}' GDM theme has been removed."; echo
fi fi
if [[ "${dash_to_dock}" == 'true' ]]; then if [[ "${dash_to_dock}" == 'true' ]]; then
echo; prompt -i "Removing '${name}' Dash to Dock theme..." prompt -i "Removing '${name}' Dash to Dock theme..."
revert_dash_to_dock_theme revert_dash_to_dock_theme
echo; prompt -s "Done! '${name}' Dash to Dock theme has been removed." prompt -s "Done! '${name}' Dash to Dock theme has been removed."; echo
fi fi
if [[ "${firefox}" == 'true' ]]; then if [[ "${firefox}" == 'true' ]]; then
echo; prompt -i "Removing '${name}' Firefox theme..." prompt -i "Removing '${name}' Firefox theme..."
remove_firefox_theme remove_firefox_theme
echo; prompt -s "Done! '${name}' Firefox theme has been removed." prompt -s "Done! '${name}' Firefox theme has been removed."; echo
fi fi
if [[ "${snap}" == 'true' ]]; then if [[ "${snap}" == 'true' ]]; then
echo; prompt -i "Disconnecting '${name}' theme from your installed snap apps..." prompt -i "Disconnecting '${name}' theme from your installed snap apps..."
disconnect_snap disconnect_snap
echo; prompt -s "Done! '${name}' theme has been disconnected from your snap apps." prompt -s "Done! '${name}' theme has been disconnected from your snap apps."; echo
fi fi
if [[ "${flatpak}" == 'true' ]]; then if [[ "${flatpak}" == 'true' ]]; then
echo; prompt -i "Disconnecting '${name}' theme from your Flatpak..." prompt -i "Disconnecting '${name}' theme from your Flatpak..."
disconnect_flatpak disconnect_flatpak
echo; prompt -s "Done! '${name}' theme has been disconnected from your Flatpak." prompt -s "Done! '${name}' theme has been disconnected from your Flatpak."; echo
fi fi
else else
show_needed_dialogs; customize_theme show_needed_dialogs; customize_theme
if [[ "${gdm}" == 'true' ]]; then if [[ "${gdm}" == 'true' ]]; then
echo; prompt -i "Installing '${name}' GDM theme..." prompt -i "Installing '${name}' GDM theme..."
install_gdm_theme install_gdm_theme
echo; prompt -s "Done! '${name}' GDM theme has been installed." prompt -s "Done! '${name}' GDM theme has been installed."; echo
fi fi
if [[ "${dash_to_dock}" == 'true' ]]; then if [[ "${dash_to_dock}" == 'true' ]]; then
echo; prompt -i "Installing '${name}' ${colors[0]} Dash to Dock theme..." prompt -i "Installing '${name}' ${colors[0]} Dash to Dock theme..."
install_dash_to_dock_theme install_dash_to_dock_theme
echo; prompt -s "Done! '${name}' Dash to Dock theme has been installed." prompt -s "Done! '${name}' Dash to Dock theme has been installed."
prompt -w "DASH TO DOCK: You may need to logout to take effect." prompt -w "DASH TO DOCK: You may need to logout to take effect."; echo
fi fi
if [[ "${firefox}" == 'true' || "${edit_firefox}" == 'true' ]]; then if [[ "${firefox}" == 'true' || "${edit_firefox}" == 'true' ]]; then
if [[ "${firefox}" == 'true' ]]; then if [[ "${firefox}" == 'true' ]]; then
echo; prompt -i "Installing '${name}' Firefox theme..." prompt -i "Installing '${name}' Firefox theme..."
install_firefox_theme install_firefox_theme
echo; prompt -s "Done! '${name}' Firefox theme has been installed." prompt -s "Done! '${name}' Firefox theme has been installed."; echo
fi fi
if [[ "${edit_firefox}" == 'true' ]]; then if [[ "${edit_firefox}" == 'true' ]]; then
echo; prompt -i "Editing '${name}' Firefox theme preferences..." prompt -i "Editing '${name}' Firefox theme preferences..."
edit_firefox_theme_prefs edit_firefox_theme_prefs
echo; prompt -s "Done! '${name}' Firefox theme preferences has been edited." prompt -s "Done! '${name}' Firefox theme preferences has been edited."; echo
fi fi
echo
prompt -w "FIREFOX: Please go to [Firefox menu] > [Customize...], and customize your Firefox to make it work. Move your 'new tab' button to the titlebar instead of tab-switcher." prompt -w "FIREFOX: Please go to [Firefox menu] > [Customize...], and customize your Firefox to make it work. Move your 'new tab' button to the titlebar instead of tab-switcher."
prompt -i "FIREFOX: Anyways, you can also edit 'userChrome.css' and 'customChrome.css' later in your Firefox profile directory." prompt -i "FIREFOX: Anyways, you can also edit 'userChrome.css' and 'customChrome.css' later in your Firefox profile directory."
echo
fi fi
if [[ "${snap}" == 'true' ]]; then if [[ "${snap}" == 'true' ]]; then
echo; prompt -i "Connecting '${name}' theme to your installed snap apps..." prompt -i "Connecting '${name}' theme to your installed snap apps..."
connect_snap connect_snap
echo; prompt -s "Done! '${name}' theme has been connected to your snap apps." prompt -s "Done! '${name}' theme has been connected to your snap apps."; echo
fi fi
if [[ "${flatpak}" == 'true' ]]; then if [[ "${flatpak}" == 'true' ]]; then
echo; prompt -i "Connecting '${name}' theme to your Flatpak..." prompt -i "Connecting '${name}' theme to your Flatpak..."
connect_flatpak connect_flatpak
echo; prompt -s "Done! '${name}' theme has been connected to your Flatpak." prompt -s "Done! '${name}' theme has been connected to your Flatpak."; echo
fi fi
fi fi
if [[ "${firefox}" == "false" && "${edit_firefox}" == "false" && "${flatpak}" == "false" && "${snap}" == "false" && "${gdm}" == "false" && "${dash_to_dock}" == "false" ]]; then if [[ "${firefox}" == "false" && "${edit_firefox}" == "false" && "${flatpak}" == "false" && "${snap}" == "false" && "${gdm}" == "false" && "${dash_to_dock}" == "false" ]]; then
echo; prompt -e "Oops... there's nothing to tweak..." prompt -e "Oops... there's nothing to tweak..."
echo; prompt -i "HINT: Don't forget to define which component to tweak, e.g. '--gdm'" prompt -i "HINT: Don't forget to define which component to tweak, e.g. '--gdm'"
echo; prompt -i "HINT: Run ./tweaks.sh -h for help!..." prompt -i "HINT: Run ./tweaks.sh -h for help!..."; echo
fi fi
echo