aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-22 21:45:23 +0100
committerArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-22 21:45:23 +0100
commita1641c8d09afc59f0977335d823a6bc896d8e1e2 (patch)
tree39cc082117508fd77e95681a71124a25a627c2a4
parent1564018f3479566c99ef1dad46c811241898946e (diff)
Updates to dwmbarrc
Offline and Online modules will get added soon, but need to be implemented differently.
-rw-r--r--TODO.org2
-rwxr-xr-xdwmbarrc43
2 files changed, 28 insertions, 17 deletions
diff --git a/TODO.org b/TODO.org
index 1f21ec3..2f06532 100644
--- a/TODO.org
+++ b/TODO.org
@@ -16,7 +16,7 @@ Each module writes to stdout.
Bugs to fix
- Sometimes double |
- Cpuload module is way too slow. fix. (archie)
-- Status bar starts to close to screen (add space)
+- Status bar starts to close to screen (add space) (archie)
Modules to Write:
*We are more than welcome to accept ideas and pull requests for future
diff --git a/dwmbarrc b/dwmbarrc
index 25542df..6ee8ffa 100755
--- a/dwmbarrc
+++ b/dwmbarrc
@@ -2,31 +2,42 @@
# Example file, designed to be edited.
-DELAY=5
+DELAY=0.05
MODULES_DIR="/home/$USER/.config/dwmbar/modules/"
-CUSTOM_DIR="$MODULES_DIR/custom/"
+CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
SEPARATOR=" | "
+PADDING=" "
-# Add and remove modules here
-# Modules that dont require an internet conneciton
-OFFLINE_MODULES="wifi internet bluetooth volume temperature date time battery"
-# Modules that require an internet connection
-ONLINE_MODULES=""
+OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
+OUTPUT=""
-run_modules(){
+MODULES="mpd volumebar wifi redshift disksize ram temperature date time battery"
+
+get_bar(){
for module in $MODULES; do
- [[ ! "$OUTPUT" = "" ]] && OUTPUT="$OUTPUT$SEPARATOR"
- if [[ -f "$CUSTOM_DIR$module" ]]; then
- OUTPUT="$OUTPUT$(exec $CUSTOM_DIR$module)"
- else
- OUTPUT="$OUTPUT$(exec $MODULES_DIR$module)"
- fi
+ module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')
+ bar=$bar$module_out
done
+ echo $bar | sed 's/.$//g'
+}
+
+run_module(){
+ if [[ -f "$CUSTOM_DIR$1" ]]
+ then
+ out="$(exec $CUSTOM_DIR$1)"
+ else
+ out="$(exec $MODULES_DIR$1)"
+ fi
+
+ [[ ! "$out" = "" ]] && [[ ! "$module" = "NULL" ]] && out="$out$SEPARATOR."
+ echo $out > "$OUTPUT_CACHE$module"
}
run(){
- run_modules
- echo $OUTPUT
+ for module in $MODULES; do
+ run_module $module
+ done
+ get_bar
sleep $DELAY;
}