From f5fbbb7572a685c695515d23969fbfaf7b4d011f Mon Sep 17 00:00:00 2001 From: "Archie Hilton (thytom)" Date: Wed, 23 Oct 2019 14:46:23 +0100 Subject: Updated TODO, fixed internet modules --- dwmbarrc | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'dwmbarrc') diff --git a/dwmbarrc b/dwmbarrc index 626e7d0..84534ea 100755 --- a/dwmbarrc +++ b/dwmbarrc @@ -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" -# Modules that require an active internet connection -ONLINE_MODULES="weather" +# 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 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; -- cgit v1.2.3