mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2025-03-13 17:09:22 +00:00
Updates to dwmbarrc
Offline and Online modules will get added soon, but need to be implemented differently.
This commit is contained in:
parent
1564018f34
commit
a1641c8d09
2 changed files with 28 additions and 17 deletions
2
TODO.org
2
TODO.org
|
@ -16,7 +16,7 @@ Each module writes to stdout.
|
||||||
Bugs to fix
|
Bugs to fix
|
||||||
- Sometimes double |
|
- Sometimes double |
|
||||||
- Cpuload module is way too slow. fix. (archie)
|
- 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:
|
Modules to Write:
|
||||||
*We are more than welcome to accept ideas and pull requests for future
|
*We are more than welcome to accept ideas and pull requests for future
|
||||||
|
|
43
dwmbarrc
43
dwmbarrc
|
@ -2,31 +2,42 @@
|
||||||
|
|
||||||
# Example file, designed to be edited.
|
# Example file, designed to be edited.
|
||||||
|
|
||||||
DELAY=5
|
DELAY=0.05
|
||||||
MODULES_DIR="/home/$USER/.config/dwmbar/modules/"
|
MODULES_DIR="/home/$USER/.config/dwmbar/modules/"
|
||||||
CUSTOM_DIR="$MODULES_DIR/custom/"
|
CUSTOM_DIR="/home/$USER/.config/dwmbar/modules/custom/"
|
||||||
SEPARATOR=" | "
|
SEPARATOR=" | "
|
||||||
|
PADDING=" "
|
||||||
|
|
||||||
# Add and remove modules here
|
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
|
||||||
# Modules that dont require an internet conneciton
|
OUTPUT=""
|
||||||
OFFLINE_MODULES="wifi internet bluetooth volume temperature date time battery"
|
|
||||||
# Modules that require an internet connection
|
|
||||||
ONLINE_MODULES=""
|
|
||||||
|
|
||||||
run_modules(){
|
MODULES="mpd volumebar wifi redshift disksize ram temperature date time battery"
|
||||||
|
|
||||||
|
get_bar(){
|
||||||
for module in $MODULES; do
|
for module in $MODULES; do
|
||||||
[[ ! "$OUTPUT" = "" ]] && OUTPUT="$OUTPUT$SEPARATOR"
|
module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')
|
||||||
if [[ -f "$CUSTOM_DIR$module" ]]; then
|
bar=$bar$module_out
|
||||||
OUTPUT="$OUTPUT$(exec $CUSTOM_DIR$module)"
|
|
||||||
else
|
|
||||||
OUTPUT="$OUTPUT$(exec $MODULES_DIR$module)"
|
|
||||||
fi
|
|
||||||
done
|
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(){
|
||||||
run_modules
|
for module in $MODULES; do
|
||||||
echo $OUTPUT
|
run_module $module
|
||||||
|
done
|
||||||
|
get_bar
|
||||||
sleep $DELAY;
|
sleep $DELAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue