Xfce: panel vpn script show also ip for tap interfaces

This commit is contained in:
Daniel Ruiz de Alegría 2022-12-09 00:25:00 +01:00
parent 93baaaf677
commit aa8c07a068
No known key found for this signature in database
GPG Key ID: 59667A77E8BFCB6C

View File

@ -1,8 +1,10 @@
#!/bin/sh
ip="$(ip a s tun0 2>/dev/null | grep -o -P '(?<=inet )[0-9]{1,3}(\.[0-9]{1,3}){3}')"
interface="$(ip tuntap show | cut -d : -f1 | head -n 1)"
ip="$(ip a s "${interface}" 2>/dev/null \
| grep -o -P '(?<=inet )[0-9]{1,3}(\.[0-9]{1,3}){3}')"
if [ "$ip" != "" ]; then
if [ "${ip}" != "" ]; then
printf "<icon>network-vpn-symbolic</icon>"
printf "<txt>${ip}</txt>"
printf "<tool>VPN IP</tool>"