Made dwmbar only copy files when explicitly told.

This commit is contained in:
Archie Hilton (thytom) 2019-10-23 15:04:02 +01:00
parent f5fbbb7572
commit 9e41bf1bc6

18
dwmbar
View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
VERSION="0.0.1" VERSION="0.1"
RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc" RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc"
CONFIG_DIR="/home/$USER/.config/dwmbar" CONFIG_DIR="/home/$USER/.config/dwmbar"
@ -9,10 +9,13 @@ DWMBARRC="$CONFIG_DIR/dwmbarrc"
CACHE_DIR="$CONFIG_DIR/.cache" CACHE_DIR="$CONFIG_DIR/.cache"
print_help(){ print_help(){
echo "dwmbar $VERSION" echo "dwmbar $VERSION
-v Display this help message.
-c Copy default files to /home/$USER/.config/dwmbar
"
} }
install_files(){ 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 $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC [[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC
[[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR [[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR
@ -20,7 +23,14 @@ install_files(){
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR [[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
} }
install_files while getopts 'v' flag; do
case "${flag}" in
v) print_help
exit 0 ;;
c) copy_usr_to_home
exit 0 ;;
esac
done
while :; do while :; do
xsetroot -name "$(exec $RC_LOCATION)" xsetroot -name "$(exec $RC_LOCATION)"