Merge pull request #14 from thytom/tack-c

Improved -c functionality
This commit is contained in:
Archie Hilton 2019-11-06 14:39:45 +00:00 committed by GitHub
commit 0c613b4b58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

4
bar.sh
View file

@ -17,7 +17,11 @@
MODULES_DIR="/usr/share/dwmbar/modules/" MODULES_DIR="/usr/share/dwmbar/modules/"
if [[ -d $CACHE_DIR ]]; then
OUTPUT_CACHE="$CACHE_DIR"
else
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
fi
OUTPUT="" OUTPUT=""
CONFIG_FILE="/home/$USER/.config/dwmbar/config" CONFIG_FILE="/home/$USER/.config/dwmbar/config"

17
dwmbar
View file

@ -23,7 +23,8 @@ DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config"
CONFIG_DIR="/home/$USER/.config/dwmbar" CONFIG_DIR="/home/$USER/.config/dwmbar"
CUSTOM_DIR="$CONFIG_DIR/custom" CUSTOM_DIR="$CONFIG_DIR/custom"
CONFIG_FILE="$CONFIG_DIR/config" CONFIG_FILE="$CONFIG_DIR/config"
CACHE_DIR="$CONFIG_DIR/.cache" CACHE_DIR="$HOME/.cache/dwmbar/"
export CACHE_DIR
INTERNET=1 INTERNET=1
export INTERNET export INTERNET
@ -39,31 +40,29 @@ copy_usr_to_home(){
[[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR [[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR
[[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE [[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE
[[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR [[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
} }
check_files(){ check_files(){
if [[ ! -d $DEFAULT_CONFIG_DIR ]]; then if [[ ! -d "$DEFAULT_CONFIG_DIR" ]]; then
echo "$DEFAULT_CONFIG_DIR does not exist." > /dev/stderr echo "$DEFAULT_CONFIG_DIR does not exist." > /dev/stderr
exit 1 exit 1
fi fi
if [[ ! -d $DEFAULT_MODULES_DIR ]]; then if [[ ! -d "$DEFAULT_MODULES_DIR" ]]; then
echo "$DEFAULT_MODULES_DIR does not exist." > /dev/stderr echo "$DEFAULT_MODULES_DIR does not exist." > /dev/stderr
exit 1 exit 1
fi fi
if [[ ! -d $CACHE_DIR ]]; then if [[ ! -d "$CACHE_DIR" ]]; then
echo "$CACHE_DIR does not exist." > /dev/stderr mkdir -p "$CACHE_DIR"
exit 1
fi fi
if [[ ! -f $DEFAULT_BAR_LOCATION ]]; then if [[ ! -f "$DEFAULT_BAR_LOCATION" ]]; then
echo "$DEFAULT_BAR_LOCATION does not exist." > /dev/stderr echo "$DEFAULT_BAR_LOCATION does not exist." > /dev/stderr
exit 1 exit 1
fi fi
if [[ ! -f $DEFAULT_CONFIG_LOCATION ]]; then if [[ ! -f "$DEFAULT_CONFIG_LOCATION" ]]; then
echo "$DEFAULT_CONFIG_LOCATION does not exist." > /dev/stderr echo "$DEFAULT_CONFIG_LOCATION does not exist." > /dev/stderr
exit 1 exit 1
fi fi