aboutsummaryrefslogtreecommitdiff
path: root/dwmbarrc
diff options
context:
space:
mode:
authorArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-23 14:46:23 +0100
committerArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-10-23 14:46:23 +0100
commitf5fbbb7572a685c695515d23969fbfaf7b4d011f (patch)
tree875b757c37ddbae035ba9132a6a15accf2594ca9 /dwmbarrc
parent5f13817a9e9f1f6528456a9667451a9041911558 (diff)
Updated TODO, fixed internet modules
Diffstat (limited to 'dwmbarrc')
-rwxr-xr-xdwmbarrc28
1 files changed, 17 insertions, 11 deletions
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;