dotfiles/.i3blocks/internet

38 lines
854 B
Plaintext
Raw Normal View History

2018-03-06 18:49:41 +01:00
#!/bin/bash
2022-09-19 21:23:33 +02:00
declare color
2021-09-09 01:46:43 +02:00
2018-03-06 18:49:41 +01:00
if ! nmcli dev | grep " connecté" &>/dev/null
then
2020-11-06 02:01:43 +01:00
color="#747369"
2018-03-06 18:49:41 +01:00
if [ ! -f /dev/shm/claws_offline ]
then
2022-09-19 21:23:33 +02:00
i3-msg -q -- exec claws-mail --offline
2018-03-06 18:49:41 +01:00
touch /dev/shm/claws_offline
fi
2022-09-19 21:23:33 +02:00
# https://atlas.ripe.net/anchors/about/
# fr-rns-as204092.anchors.atlas.ripe.net
elif ping -c 4 2a00:5884:822c::1 -W 1 &>/dev/null || ping -c 4 80.67.190.218 -W 1 &>/dev/null
2018-03-06 18:49:41 +01:00
then
color="#99CC99"
if [ -f /dev/shm/claws_offline ]
then
2022-02-26 22:43:20 +01:00
i3-msg -q -- exec claws-mail --online
2018-03-06 18:49:41 +01:00
rm /dev/shm/claws_offline
fi
2022-09-19 21:23:33 +02:00
# test-debit.free.fr
elif ping -c 4 2a01:e0c:1:1598::3 -W 1 &>/dev/null || ping -c 4 212.27.42.153 -W 1 &>/dev/null
2022-09-19 21:23:33 +02:00
then
color="#FFCC66"
2018-03-06 18:49:41 +01:00
else
if [ ! -f /dev/shm/claws_offline ]
then
2022-09-19 21:23:33 +02:00
i3-msg -q -- exec claws-mail --offline
2018-03-06 18:49:41 +01:00
touch /dev/shm/claws_offline
fi
2022-09-19 21:23:33 +02:00
color="#F2777A"
2018-03-06 18:49:41 +01:00
fi
2020-12-31 11:14:20 +01:00
echo "<span foreground=\"$color\">re</span>"
2022-09-19 21:23:33 +02:00