aboutsummaryrefslogtreecommitdiff
path: root/bar.sh
diff options
context:
space:
mode:
authorArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-11-01 18:21:46 +0000
committerArchie Hilton (thytom) <archie.hilton1@gmail.com>2019-11-01 18:21:46 +0000
commit83de952093c62ead12a2a8d824718befb8cba3aa (patch)
treed42a792b8ecdfe4e140ce8fa5cc4d45f34bbb23d /bar.sh
parent10570d7692ed6ef83d1513587f8618002da6386f (diff)
Fixed CPU issue and made internet work
Bash backgrounding is bloat
Diffstat (limited to 'bar.sh')
-rwxr-xr-xbar.sh21
1 files changed, 4 insertions, 17 deletions
diff --git a/bar.sh b/bar.sh
index ca7df84..1955ee7 100755
--- a/bar.sh
+++ b/bar.sh
@@ -23,19 +23,6 @@ OUTPUT=""
CONFIG_FILE="/home/$USER/.config/dwmbar/config"
source $CONFIG_FILE
-INTERNET=1 #0 being true
-
-get_internet()
-{
- curl -q http://google.com &> /dev/null
-
- if [[ $? -eq 0 ]]; then
- INTERNET=0
- else
- INTERNET=1
- fi
-}
-
get_bar()
{
for module in $MODULES; do
@@ -64,12 +51,12 @@ run_module()
run()
{
- get_internet
for module in $MODULES; do
pgrep $module &> /dev/null
- if [[ $? -eq 1 ]] && [[ $INTERNET -eq 0 ]]; then
- run_module $module &
- else
+ notrunning=$([[ $? -eq 1 ]])
+ if $notrunning && [[ $INTERNET -eq 0 ]]; then
+ run_module $module
+ elif $notrunning && [[ $INTERNET -eq 1 ]]; then
[[ "$ONLINE_MODULES" != *"$module"* ]] && run_module $module
fi
done