dotfiles/.i3blocks/internet
2020-12-31 11:14:20 +01:00

31 lines
575 B
Bash
Executable file

#!/bin/bash
color=""
if ! nmcli dev | grep " connecté" &>/dev/null
then
color="#747369"
if [ ! -f /dev/shm/claws_offline ]
then
claws-mail --offline
touch /dev/shm/claws_offline
fi
elif ping -c 1 1.1.1.1 -W 1 &>/dev/null || ping -c 1 8.8.8.8 -W 1 &>/dev/null
then
color="#99CC99"
if [ -f /dev/shm/claws_offline ]
then
claws-mail --online
rm /dev/shm/claws_offline
fi
else
color="#F2777A"
if [ ! -f /dev/shm/claws_offline ]
then
claws-mail --offline
touch /dev/shm/claws_offline
color="#FFCC66"
fi
fi
echo "<span foreground=\"$color\">re</span>"