Updated TODO, fixed internet modules

This commit is contained in:
Archie Hilton (thytom) 2019-10-23 14:46:23 +01:00
parent 5f13817a9e
commit f5fbbb7572
2 changed files with 21 additions and 18 deletions

View file

@ -11,15 +11,13 @@ Each module writes to stdout.
* Todo List * Todo List
- Different file for customizable stuff - Different file for customizable stuff
- Add --rootdir option to install script - dwmbar uses /usr/bin/dwmbarrc if no .config/dwmbar/dwmbarrc exists.
Bugs to fix Bugs to fix:
- Sometimes double | None
- Cpuload module is way too slow. fix. (archie)
- 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
modules! modules!
Working Modules: Working Modules:
@ -44,4 +42,3 @@ Working Modules:
Scripts: Scripts:
- Individual module delays. - Individual module delays.
- Make install script install locally and not for root.

View file

@ -11,30 +11,32 @@ PADDING="$USER@$HOSTNAME "
OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/" OUTPUT_CACHE="/home/$USER/.config/dwmbar/.cache/"
OUTPUT="" OUTPUT=""
# All modules that you want present in the status bar # What modules, in what order
MODULES="mpd volumebar wifi redshift disksize ram temperature date time battery" MODULES="mpd weather volumebar wifi internet cpuload temperature battery date time"
# Modules that require an active internet connection # Modules that require an active internet connection
ONLINE_MODULES="weather" ONLINE_MODULES="weather internet"
INTERNET=1 #0 being true
INTERNET=false
get_internet() get_internet()
{ {
curl -q http://google.com &> /dev/null curl -q http://google.com &> /dev/null
if [ $? -eq 0 ]; then if [[ $? -eq 0 ]]; then
$INTERNET=true INTERNET=0
else else
$INTERNET=false INTERNET=1
fi fi
} }
get_bar() get_bar()
{ {
for module in $MODULES; do for module in $MODULES; do
module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g') if [[ $INTERNET -eq 0 ]] || [[ $ONLINE_MODULES != *"$module"* ]];then
bar=$bar$module_out module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')
bar=$bar$module_out
fi
done done
# Uncomment to remove last separator # Uncomment to remove last separator
# bar=$(echo $bar | sed 's/.$//g') # bar=$(echo $bar | sed 's/.$//g')
@ -58,7 +60,11 @@ run()
{ {
get_internet get_internet
for module in $MODULES; do for module in $MODULES; do
run_module $module if [[ $INTERNET -eq 0 ]]; then
run_module $module
else
[[ $ONLINE_MODULES != *"$module"* ]] && run_module $module
fi
done done
get_bar get_bar
sleep $DELAY; sleep $DELAY;