diff --git a/bar.sh b/bar.sh index 925615a..915022d 100755 --- a/bar.sh +++ b/bar.sh @@ -17,7 +17,11 @@ MODULES_DIR="/usr/share/dwmbar/modules/" -OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" +if [[ -d $CACHE_DIR ]]; then + OUTPUT_CACHE="$CACHE_DIR" +else + OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" +fi OUTPUT="" CONFIG_FILE="/home/$USER/.config/dwmbar/config" diff --git a/dwmbar b/dwmbar index 080394b..0333228 100755 --- a/dwmbar +++ b/dwmbar @@ -23,7 +23,8 @@ DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config" CONFIG_DIR="/home/$USER/.config/dwmbar" CUSTOM_DIR="$CONFIG_DIR/custom" CONFIG_FILE="$CONFIG_DIR/config" -CACHE_DIR="$CONFIG_DIR/.cache" +CACHE_DIR="$HOME/.cache/dwmbar/" +export CACHE_DIR INTERNET=1 export INTERNET @@ -39,31 +40,29 @@ copy_usr_to_home(){ [[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR [[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE [[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR - [[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR } check_files(){ - if [[ ! -d $DEFAULT_CONFIG_DIR ]]; then + if [[ ! -d "$DEFAULT_CONFIG_DIR" ]]; then echo "$DEFAULT_CONFIG_DIR does not exist." > /dev/stderr exit 1 fi - if [[ ! -d $DEFAULT_MODULES_DIR ]]; then + if [[ ! -d "$DEFAULT_MODULES_DIR" ]]; then echo "$DEFAULT_MODULES_DIR does not exist." > /dev/stderr exit 1 fi - if [[ ! -d $CACHE_DIR ]]; then - echo "$CACHE_DIR does not exist." > /dev/stderr - exit 1 - fi + if [[ ! -d "$CACHE_DIR" ]]; then + mkdir -p "$CACHE_DIR" + fi - if [[ ! -f $DEFAULT_BAR_LOCATION ]]; then + if [[ ! -f "$DEFAULT_BAR_LOCATION" ]]; then echo "$DEFAULT_BAR_LOCATION does not exist." > /dev/stderr exit 1 fi - if [[ ! -f $DEFAULT_CONFIG_LOCATION ]]; then + if [[ ! -f "$DEFAULT_CONFIG_LOCATION" ]]; then echo "$DEFAULT_CONFIG_LOCATION does not exist." > /dev/stderr exit 1 fi