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
- 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
- Sometimes double |
- Cpuload module is way too slow. fix. (archie)
- Status bar starts to close to screen (add space) (archie)
Bugs to fix:
None
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!
Working Modules:
@ -44,4 +42,3 @@ Working Modules:
Scripts:
- 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=""
# All modules that you want present in the status bar
MODULES="mpd volumebar wifi redshift disksize ram temperature date time battery"
# What modules, in what order
MODULES="mpd weather volumebar wifi internet cpuload temperature battery date time"
# Modules that require an active internet connection
ONLINE_MODULES="weather"
ONLINE_MODULES="weather internet"
INTERNET=false
INTERNET=1 #0 being true
get_internet()
{
curl -q http://google.com &> /dev/null
if [ $? -eq 0 ]; then
$INTERNET=true
if [[ $? -eq 0 ]]; then
INTERNET=0
else
$INTERNET=false
INTERNET=1
fi
}
get_bar()
{
for module in $MODULES; do
module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')
bar=$bar$module_out
if [[ $INTERNET -eq 0 ]] || [[ $ONLINE_MODULES != *"$module"* ]];then
module_out=$(cat $OUTPUT_CACHE$module | sed 's/\.$//g')
bar=$bar$module_out
fi
done
# Uncomment to remove last separator
# bar=$(echo $bar | sed 's/.$//g')
@ -58,7 +60,11 @@ run()
{
get_internet
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
get_bar
sleep $DELAY;