mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-09 14:19:43 +00:00
And some more fixes
This commit is contained in:
parent
858e26828f
commit
472ee9b149
1 changed files with 7 additions and 8 deletions
15
dwmbar
15
dwmbar
|
@ -39,7 +39,7 @@ export CONFIG_FILE
|
||||||
CACHE_DIR="$HOME/.cache/dwmbar/"
|
CACHE_DIR="$HOME/.cache/dwmbar/"
|
||||||
export CACHE_DIR
|
export CACHE_DIR
|
||||||
|
|
||||||
INTERNET=1
|
INTERNET=1 # No internet
|
||||||
export INTERNET
|
export INTERNET
|
||||||
|
|
||||||
print_help(){
|
print_help(){
|
||||||
|
@ -90,21 +90,20 @@ while getopts 'vc' flag; do
|
||||||
done
|
done
|
||||||
|
|
||||||
check_internet() {
|
check_internet() {
|
||||||
if [ $(( 10#$date % 5 )) -eq 0 ]; then
|
wget --spider -q --timeout=2 www.google.com
|
||||||
wget --spider -q www.google.com --timeout=3
|
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
INTERNET=0
|
echo 0
|
||||||
else
|
else
|
||||||
INTERNET=1
|
echo 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_files
|
check_files
|
||||||
|
|
||||||
while :; do
|
while :; do
|
||||||
date=$(date +'%S')
|
date=$(date +'%S')
|
||||||
check_internet &
|
if [ $(( 10#$date % 5 )) -eq 0 ]; then
|
||||||
|
INTERNET=$(check_internet)
|
||||||
|
fi
|
||||||
xsetroot -name "$(exec $DEFAULT_BAR_LOCATION)"
|
xsetroot -name "$(exec $DEFAULT_BAR_LOCATION)"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue