diff --git a/TODO.org b/TODO.org
index 07316d0..0646d1d 100644
--- a/TODO.org
+++ b/TODO.org
@@ -13,6 +13,10 @@ 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)
Bugs to fix:
None
diff --git a/dwmbarrc b/bar.sh
similarity index 81%
rename from dwmbarrc
rename to bar.sh
index cfe6c6f..f9866f4 100755
--- a/dwmbarrc
+++ b/bar.sh
@@ -15,20 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-DELAY=0.05
-MODULES_DIR="/home/$USER/.config/dwmbar/modules/"
-CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
-SEPARATOR=" | "
-PADDING="$USER@$HOSTNAME "
+
+MODULES_DIR="/usr/share/dwmbar/modules/"
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
OUTPUT=""
-# What modules, in what order
-MODULES="mpd weather volumebar wifi internet cpuload temperature battery date time"
-
-# Modules that require an active internet connection
-ONLINE_MODULES="weather internet"
+CONFIG_FILE="/home/$USER/.config/dwmbar/config"
+source $CONFIG_FILE
INTERNET=1 #0 being true
@@ -53,7 +47,7 @@ get_bar()
done
# Uncomment to remove last separator
# bar=$(echo $bar | sed 's/.$//g')
- echo "$bar$PADDING"
+ echo "$LEFT_PADDING$bar$RIGHT_PADDING"
}
run_module()
diff --git a/config b/config
new file mode 100644
index 0000000..c53aaeb
--- /dev/null
+++ b/config
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# What modules, in what order
+MODULES="mpd weather volumebar wifi internet cpuload temperature date time"
+
+# Modules that require an active internet connection
+ONLINE_MODULES="weather internet"
+
+# Delay between showing the status bar
+DELAY="0.05"
+
+# Where the custom modules are stored
+CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
+
+# Separator between modules
+SEPARATOR=" | "
+
+# Padding at the end and beggining of the status bar
+RIGHT_PADDING="$USER@$HOSTNAME "
+LEFT_PADDING=" "
diff --git a/dwmbar b/dwmbar
index a4d3c38..62c26ee 100755
--- a/dwmbar
+++ b/dwmbar
@@ -15,17 +15,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-VERSION="0.1"
+VERSION="0.2"
DEFAULT_CONFIG_DIR="/usr/share/dwmbar"
DEFAULT_MODULES_DIR="$DEFAULT_CONFIG_DIR/modules"
-DEFAULT_RC_LOCATION="$DEFAULT_CONFIG_DIR/dwmbarrc"
+DEFAULT_BAR_LOCATION="$DEFAULT_CONFIG_DIR/bar.sh"
+DEFAULT_CONFIG_LOCATION="$DEFAULT_CONFIG_DIR/config"
-RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc"
CONFIG_DIR="/home/$USER/.config/dwmbar"
-MODULES_DIR="$CONFIG_DIR/modules"
-CUSTOM_DIR="$MODULES_DIR/custom"
-DWMBARRC="$CONFIG_DIR/dwmbarrc"
+CUSTOM_DIR="$CONFIG_DIR/custom"
+CONFIG_FILE="$CONFIG_DIR/config"
CACHE_DIR="$CONFIG_DIR/.cache"
print_help(){
@@ -37,8 +36,7 @@ print_help(){
copy_usr_to_home(){
[[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR
- [[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC
- [[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR
+ [[ ! -f $CONFIG_FILE ]] && cp /usr/share/dwmbar/config $CONFIG_FILE
[[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
}
@@ -54,13 +52,18 @@ check_files(){
exit 1
fi
- if [[ ! -f $DEFAULT_RC_LOCATION ]]; then
- echo "$DEFAULT_RC_LOCATION does not exist." > /dev/stderr
+ if [[ ! -f $DEFAULT_BAR_LOCATION ]]; then
+ echo "$DEFAULT_BAR_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 ;;
@@ -72,5 +75,5 @@ done
check_files
while :; do
- xsetroot -name "$(exec $RC_LOCATION)"
+ xsetroot -name "$(exec $DEFAULT_BAR_LOCATION)"
done
diff --git a/install.sh b/install.sh
index 84f6a3e..c409bd2 100755
--- a/install.sh
+++ b/install.sh
@@ -28,12 +28,18 @@ 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/"
+echo "./modules --> /usr/share/dwmbar/modules"
cp -r "./modules" "/usr/share/dwmbar/modules"
-cp -r "./dwmbarrc" "/usr/share/dwmbar/dwmbarrc"
+
+echo "./bar.sh --> /usr/share/dwmbar/bar.sh"
+cp "./bar.sh" "/usr/share/dwmbar/bar.sh"
+
+echo "./config --> /usr/share/dwmbar/config"
+cp -r "./config" "/usr/share/dwmbar/config"
echo "./dwmbar --> /usr/bin/dwmbar"
cp "./dwmbar" "/usr/bin/dwmbar"