dotfiles/.i3blocks/internet
2022-09-19 21:23:33 +02:00

37 lines
854 B
Bash
Executable file

#!/bin/bash
declare color
if ! nmcli dev | grep " connecté" &>/dev/null
then
color="#747369"
if [ ! -f /dev/shm/claws_offline ]
then
i3-msg -q -- exec claws-mail --offline
touch /dev/shm/claws_offline
fi
# https://atlas.ripe.net/anchors/about/
# fr-rns-as204092.anchors.atlas.ripe.net
elif ping -c 1 2a00:5884:822c::1 -W 1 &>/dev/null || ping -c 1 80.67.190.218 -W 1 &>/dev/null
then
color="#99CC99"
if [ -f /dev/shm/claws_offline ]
then
i3-msg -q -- exec claws-mail --online
rm /dev/shm/claws_offline
fi
# test-debit.free.fr
elif ping -c 1 2a01:e0c:1:1598::3 -W 1 &>/dev/null || ping -c 1 212.27.42.153 -W 1 &>/dev/null
then
color="#FFCC66"
else
if [ ! -f /dev/shm/claws_offline ]
then
i3-msg -q -- exec claws-mail --offline
touch /dev/shm/claws_offline
fi
color="#F2777A"
fi
echo "<span foreground=\"$color\">re</span>"