dotfiles/.i3blocks/internet

37 lines
709 B
Plaintext
Raw Normal View History

2018-03-06 18:49:41 +01:00
#!/bin/bash
color=""
2021-09-09 01:46:43 +02:00
if [[ "$button" -gt 0 ]]
then
swaymsg -q -- exec nm-connection-editor
fi
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
2021-12-11 17:25:35 +01:00
#swaymsg -q -- exec claws-mail --offline
2018-03-06 18:49:41 +01:00
touch /dev/shm/claws_offline
fi
2020-05-12 18:25:43 +02:00
elif ping -c 1 1.1.1.1 -W 1 &>/dev/null || ping -c 1 8.8.8.8 -W 1 &>/dev/null
2018-03-06 18:49:41 +01:00
then
color="#99CC99"
if [ -f /dev/shm/claws_offline ]
then
2021-09-09 01:46:43 +02:00
swaymsg -q -- exec claws-mail --online
2018-03-06 18:49:41 +01:00
rm /dev/shm/claws_offline
fi
else
color="#F2777A"
if [ ! -f /dev/shm/claws_offline ]
then
2021-12-11 17:25:35 +01:00
#swaymsg -q -- exec claws-mail --offline
2018-03-06 18:49:41 +01:00
touch /dev/shm/claws_offline
color="#FFCC66"
fi
fi
2020-12-31 11:14:20 +01:00
echo "<span foreground=\"$color\">re</span>"