Detect IP VPN if is enabled

This commit is contained in:
Jesús 2019-10-01 12:30:14 -05:00
parent 141b9a8f30
commit a2d8e3bf02
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -49,8 +49,12 @@ case $1 in
AF=inet6? ;;
esac
# if no interface is found, use the first device with a global scope
IPADDR=$(ip addr show "$IF" | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
# look for the vpn connection, if no interface is found, use the first device with a global scope
if [[ $(ip addr show tun0) ]]; then
IPADDR=$(ip addr show tun0 | awk '/inet.*brd/ {print $2}' | awk -F'/' '{print $1}')
else
IPADDR=$(ip addr show "$IF" | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
fi
case $BLOCK_BUTTON in
3) echo -n "$IPADDR" | xclip -q -se c ;;