diff --git a/neofetch b/neofetch index e25c8228..66c4ab3c 100755 --- a/neofetch +++ b/neofetch @@ -2480,6 +2480,14 @@ trim() { # Other {{{ +# Error {{{ + +err () { + err+="$(color 1)[!]$(color fg) $1 \n" +} + +# }}} + # Get script directory {{{ getscriptdir () { @@ -2500,6 +2508,34 @@ getscriptdir () { script_dir="$(pwd -P)" } +# }}} + +# Source default config {{{ + +getdefaultconfig () { + if [ -f "/usr/share/neofetch/config" ]; then + default_config="/usr/share/neofetch/config" + + elif [ -f "/usr/local/share/neofetch/config" ]; then + default_config="/usr/local/share/neofetch/config" + + else + getscriptdir + default_config="${script_dir}/config/config" + fi + + if [ -f "$default_config" ]; then + source "$default_config" + err "Sourced default config ($default_config)" + else + err "Default config not found, continuing..." + fi +} + +# Source config file +getdefaultconfig 2>/dev/null + + # }}} # Source Config {{{ @@ -2541,27 +2577,7 @@ case "$@" in config="off" ;; esac -[ "$config" == "on" ] && getconfig 2>/dev/null - -# }}} - -# Source default config {{{ - -getdefaultconfig () { - if [ -f "/usr/share/neofetch/config" ]; then - default_config="/usr/share/neofetch/config" - - elif [ -f "/usr/local/share/neofetch/config" ]; then - default_config="/usr/local/share/neofetch/config" - - else - getscriptdir - default_config="${script_dir}/config/config" - fi - - source "$default_config" - err "Sourced default config ($default_config)" -} +[ "${config:-on}" == "on" ] && getconfig 2>/dev/null # }}} @@ -2618,14 +2634,6 @@ kdeconfigdir () { # }}} -# Error {{{ - -err () { - err+="$(color 1)[!]$(color fg) $1 \n" -} - -# }}} - # }}} @@ -2962,10 +2970,6 @@ done # Call Functions and Finish Up {{{ - -# Source config file -getdefaultconfig - # Restore cursor and clear screen on ctrl+c trap 'printf "\033[?25h"; clear; exit' 2