aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/i3blocks/vpn
blob: dbaed98c21b7a5f08d003b83abc70b0520487e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

INSTANCE="${BLOCK_INSTANCE:-}"

# Check VPN status
GET_VPN=$(ip route | grep -E -- "tun0|$INSTANCE" | awk '{ print $3 }')

# Store status
if [[ $GET_VPN == *"tun0"* ||  $GET_VPN == "$INSTANCE" ]]
then
    echo -e "<span color='#00FF00'>ON</span>\n"
else
    echo -e "<span color='#FFDD00'>OFF</span>\n"
fi