diff --git a/TODO.org b/TODO.org index 07316d0..9d5d61e 100644 --- a/TODO.org +++ b/TODO.org @@ -13,6 +13,11 @@ Each module writes to stdout. - Different file for customizable stuff - dwmbar uses /usr/bin/dwmbarrc if no .config/dwmbar/dwmbarrc exists. - Delay in archupdates module (if minutes divisible by 5/4) +- Add dependencies like bc +- Have default modules in /usr/share/dwmbar and all the modules in the + .config/dwmbar/modules override the default ones (no need to have a custom + module dir) +- Fix modules like temp cutting out when running Bugs to fix: None diff --git a/bar.sh b/bar.sh index 88455ae..c56cfa1 100755 --- a/bar.sh +++ b/bar.sh @@ -15,22 +15,22 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -CONFIG_NAME="config" +CONFIG_FILE="/home/$USER/.config/dwmbar/config" -DELAY=$(cat $CONFIG_NAME | grep -E "DELAY" | cut -d '"' -f2) +DELAY=$(cat $CONFIG_FILE | grep -E "DELAY" | cut -d '"' -f2) MODULES_DIR="/home/$USER/.config/dwmbar/modules/" -CUSTOM_DIR=$(cat $CONFIG_NAME | grep -E "CUSTOM_DIR" | cut -d '"' -f2) -SEPARATOR=$(cat $CONFIG_NAME | grep -E "SEPARATOR" | cut -d '"' -f2) -PADDING=$(cat $CONFIG_NAME | grep -E "PADDING" | cut -d '"' -f2) +CUSTOM_DIR=$(cat $CONFIG_FILE | grep -E "CUSTOM_DIR" | cut -d '"' -f2) +SEPARATOR=$(cat $CONFIG_FILE | grep -E "SEPARATOR" | cut -d '"' -f2) +PADDING=$(cat $CONFIG_FILE | grep -E "PADDING" | cut -d '"' -f2) OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" OUTPUT="" # What modules, in what order -MODULES=$(cat $CONFIG_NAME | grep -E "MODULES" | cut -d '"' -f2) +MODULES=$(cat $CONFIG_FILE | grep -E "MODULES" | cut -d '"' -f2) # Modules that require an active internet connection -ONLINE_MODULES=$(cat $CONFIG_NAME | grep -E "ONLINE_MODULES" | cut -d '"' -f2) +ONLINE_MODULES=$(cat $CONFIG_FILE | grep -E "ONLINE_MODULES" | cut -d '"' -f2) INTERNET=1 #0 being true diff --git a/dwmbar b/dwmbar index a4d3c38..f0514c7 100755 --- a/dwmbar +++ b/dwmbar @@ -19,13 +19,15 @@ VERSION="0.1" DEFAULT_CONFIG_DIR="/usr/share/dwmbar" DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules" -DEFAULT_RC_LOCATION="$DEFAULT_CONFIG_DIR/dwmbarrc" +DEFAULT_RC_LOCATION="$DEFAULT_CONFIG_DIR/bar.sh" +DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config" -RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc" +RC_LOCATION="/home/$USER/.config/dwmbar/bar.sh" CONFIG_DIR="/home/$USER/.config/dwmbar" MODULES_DIR="$CONFIG_DIR/modules" CUSTOM_DIR="$MODULES_DIR/custom" -DWMBARRC="$CONFIG_DIR/dwmbarrc" +DWMBARRC="$CONFIG_DIR/bar.sh" +CONFIG_FILE="$CONFIG_DIR/config" CACHE_DIR="$CONFIG_DIR/.cache" print_help(){ @@ -37,7 +39,8 @@ print_help(){ copy_usr_to_home(){ [[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR - [[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC + [[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/bar.sh $DWMBARRC + [[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE [[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR [[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR [[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR @@ -58,9 +61,14 @@ check_files(){ echo "$DEFAULT_RC_LOCATION does not exist." > /dev/stderr exit 1 fi + + if [[ ! -f $DEFAULT_CONFIG_LOCATION ]]; then + echo "$DEFAULT_CONFIG_LOCATION does not exist." > /dev/stderr + exit 1 + fi } -while getopts 'v' flag; do +while getopts 'vc' flag; do case "${flag}" in v) print_help exit 0 ;; diff --git a/install.sh b/install.sh index 84f6a3e..715c989 100755 --- a/install.sh +++ b/install.sh @@ -28,12 +28,13 @@ if [[ ! -f "dwmbar" ]]; then fi # Create /usr/share/dwmbar -# Containing example dwmbarrc and modules +# Containing example bar.sh and modules mkdir --parents "/usr/share/dwmbar/" cp -r "./modules" "/usr/share/dwmbar/modules" -cp -r "./dwmbarrc" "/usr/share/dwmbar/dwmbarrc" +cp -r "./bar.sh" "/usr/share/dwmbar/bar.sh" +cp -r "./config" "/usr/share/dwmbar/config" echo "./dwmbar --> /usr/bin/dwmbar" cp "./dwmbar" "/usr/bin/dwmbar"