dotfiles/.i3blocks/internet

37 lines
714 B
Bash
Executable File

#!/bin/bash
color=""
if [[ "$button" -gt 0 ]]
then
i3-msg -q -- exec nm-connection-editor
fi
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
elif ping -c 1 212.27.48.4 -W 1 &>/dev/null || ping -c 1 80.67.169.40 -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
else
color="#F2777A"
if [ ! -f /dev/shm/claws_offline ]
then
#i3-msg -q -- exec claws-mail --offline
touch /dev/shm/claws_offline
color="#FFCC66"
fi
fi
echo "<span foreground=\"$color\">re</span>"