From 22bc88823a786acb400534177d4479da5d7e17fa Mon Sep 17 00:00:00 2001 From: Muhammad Rivan Date: Sun, 13 Jun 2021 21:47:00 +0700 Subject: [PATCH] Improve stability --- install.sh | 2 +- lib-core.sh | 21 ++++++++++--------- tweaks.sh | 58 ++++++++++++++++++++++++++--------------------------- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/install.sh b/install.sh index 6b87bfc..6bd2eb3 100755 --- a/install.sh +++ b/install.sh @@ -143,7 +143,7 @@ else # 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." notif_msg="${msg}\n\n${final_msg}" diff --git a/lib-core.sh b/lib-core.sh index 884084a..1d9f9fb 100755 --- a/lib-core.sh +++ b/lib-core.sh @@ -667,18 +667,21 @@ full_sudo() { } get_http_response() { - exec 3<> "/dev/tcp/${1}/80" - echo -e "GET / HTTP/1.1\nHost: ${1}\n\n" >&3 + if exec 3<> "/dev/tcp/${1}/80"; then + echo -e "GET / HTTP/1.1\nHost: ${1}\n\n" >&3 - ( - IFS="" + ( + IFS="" - while read -r -t 1 line 0<&3; do - echo "${line//$"\r"}" - done - ) + while read -r -t 1 line 0<&3; do + echo "${line//$"\r"}" + done + ) - exec 3<&- + exec 3<&-; return 0 + else + exec 3<&-; return 1 + fi } usage() { diff --git a/tweaks.sh b/tweaks.sh index ce01337..1a399df 100755 --- a/tweaks.sh +++ b/tweaks.sh @@ -43,6 +43,8 @@ usage() { #-----------------------------PARSE ARGUMENTS---------------------------------# +echo + while [[ $# -gt 0 ]]; do # 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 @@ -140,85 +142,83 @@ if [[ "${uninstall}" == 'true' ]]; then prompt -w "REMOVAL: Non file-related parameters will be ignored." if [[ "${gdm}" == 'true' ]]; then - echo; prompt -i "Removing '${name}' GDM theme..." + prompt -i "Removing '${name}' 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 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 - 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 if [[ "${firefox}" == 'true' ]]; then - echo; prompt -i "Removing '${name}' Firefox theme..." + prompt -i "Removing '${name}' 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 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 - 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 if [[ "${flatpak}" == 'true' ]]; then - echo; prompt -i "Disconnecting '${name}' theme from your Flatpak..." + prompt -i "Disconnecting '${name}' theme from your 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 else show_needed_dialogs; customize_theme if [[ "${gdm}" == 'true' ]]; then - echo; prompt -i "Installing '${name}' GDM theme..." + prompt -i "Installing '${name}' 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 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 - echo; 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 -s "Done! '${name}' Dash to Dock theme has been installed." + prompt -w "DASH TO DOCK: You may need to logout to take effect."; echo fi if [[ "${firefox}" == 'true' || "${edit_firefox}" == 'true' ]]; then if [[ "${firefox}" == 'true' ]]; then - echo; prompt -i "Installing '${name}' Firefox theme..." + prompt -i "Installing '${name}' 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 if [[ "${edit_firefox}" == 'true' ]]; then - echo; prompt -i "Editing '${name}' Firefox theme preferences..." + prompt -i "Editing '${name}' Firefox theme preferences..." 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 - 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 -i "FIREFOX: Anyways, you can also edit 'userChrome.css' and 'customChrome.css' later in your Firefox profile directory." + echo fi 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 - 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 if [[ "${flatpak}" == 'true' ]]; then - echo; prompt -i "Connecting '${name}' theme to your Flatpak..." + prompt -i "Connecting '${name}' theme to your 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 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..." - echo; 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 -e "Oops... there's nothing to tweak..." + prompt -i "HINT: Don't forget to define which component to tweak, e.g. '--gdm'" + prompt -i "HINT: Run ./tweaks.sh -h for help!..."; echo fi - -echo