mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2025-03-13 00:56:13 +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
|
||||
- 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
|
||||
|
|
43
dwmbarrc
43
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue