2019-10-21 18:20:09 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-10-21 19:28:26 +00:00
|
|
|
# Example file, designed to be edited.
|
|
|
|
|
2019-10-22 20:45:23 +00:00
|
|
|
DELAY=0.05
|
2019-10-22 00:19:44 +00:00
|
|
|
MODULES_DIR="/home/$USER/.config/dwmbar/modules/"
|
2019-10-22 20:45:23 +00:00
|
|
|
CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
|
2019-10-21 18:44:10 +00:00
|
|
|
SEPARATOR=" | "
|
2019-10-22 20:45:23 +00:00
|
|
|
PADDING=" "
|
2019-10-21 18:44:10 +00:00
|
|
|
|
2019-10-22 20:45:23 +00:00
|
|
|
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
|
|
|
|
OUTPUT=""
|
2019-10-21 18:44:10 +00:00
|
|
|
|
2019-10-22 20:45:23 +00:00
|
|
|
MODULES="mpd volumebar wifi redshift disksize ram temperature date time battery"
|
|
|
|
|
|
|
|
get_bar(){
|
2019-10-21 18:44:10 +00:00
|
|
|
for module in $MODULES; do
|
2019-10-22 20:45:23 +00:00
|
|
|
module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')
|
|
|
|
bar=$bar$module_out
|
2019-10-21 18:44:10 +00:00
|
|
|
done
|
2019-10-22 20:45:23 +00:00
|
|
|
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"
|
2019-10-21 18:20:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run(){
|
2019-10-22 20:45:23 +00:00
|
|
|
for module in $MODULES; do
|
|
|
|
run_module $module
|
|
|
|
done
|
|
|
|
get_bar
|
2019-10-21 19:40:41 +00:00
|
|
|
sleep $DELAY;
|
2019-10-21 18:20:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run
|