aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchie Hilton <archie.hilton1@gmail.com>2019-11-06 14:39:45 +0000
committerGitHub <noreply@github.com>2019-11-06 14:39:45 +0000
commit0c613b4b58c7f54ce708f22561d00d8a5359aceb (patch)
treee0f73559309e5aea75308e534f88875f901764b3
parent1859364ce77e517f7169f15fb851b6edc60f317f (diff)
parentf7ca49ffe7fc5ee6ebbb8e841eae3538bf243365 (diff)
Merge pull request #14 from thytom/tack-c
Improved -c functionality
-rwxr-xr-xbar.sh6
-rwxr-xr-xdwmbar19
2 files changed, 14 insertions, 11 deletions
diff --git a/bar.sh b/bar.sh
index 534ae87..05a2056 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