aboutsummaryrefslogtreecommitdiff
path: root/dwmbar
diff options
context:
space:
mode:
authorArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-23 15:14:27 +0100
committerArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-23 15:14:27 +0100
commit77a41faeacb89431af366198eb2bce671b9ff787 (patch)
treef6d19c68a10d58708b4e322154bd4495af31f238 /dwmbar
parent9e41bf1bc6935af7ba407d88166023ca70225d54 (diff)
Added better error checking in install and dwmbar
Diffstat (limited to 'dwmbar')
-rwxr-xr-xdwmbar23
1 files changed, 23 insertions, 0 deletions
diff --git a/dwmbar b/dwmbar
index 84582af..adf2882 100755
--- a/dwmbar
+++ b/dwmbar
@@ -1,6 +1,10 @@
#!/bin/bash
VERSION="0.1"
+DEFAULT_CONFIG_DIR="/usr/share/dwmbar"
+DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules"
+DEFAULT_RC_LOCATION="$DEFAULT_CONFIG_DIR/dwmbarrc"
+
RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc"
CONFIG_DIR="/home/$USER/.config/dwmbar"
MODULES_DIR="$CONFIG_DIR/modules"
@@ -23,6 +27,23 @@ copy_usr_to_home(){
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
}
+check_files(){
+ if [[ ! -d $DEFAULT_CONFIG_DIR ]]; then
+ echo "$DEFAULT_CONFIG_DIR does not exist." > /dev/stderr
+ exit 1
+ fi
+
+ if [[ ! -d $DEFAULT_MODULES_DIR ]]; then
+ echo "$DEFAULT_MODULES_DIR does not exist." > /dev/stderr
+ exit 1
+ fi
+
+ if [[ ! -f $DEFAULT_RC_LOCATION ]]; then
+ echo "$DEFAULT_RC_LOCATION does not exist." > /dev/stderr
+ exit 1
+ fi
+}
+
while getopts 'v' flag; do
case "${flag}" in
v) print_help
@@ -32,6 +53,8 @@ while getopts 'v' flag; do
esac
done
+check_files
+
while :; do
xsetroot -name "$(exec $RC_LOCATION)"
done