Add support VPN for OpenVPN and WireGuard
This commit is contained in:
parent
d971de1367
commit
be12a6b78c
@ -104,9 +104,8 @@ interval=5
|
|||||||
|
|
||||||
[vpn]
|
[vpn]
|
||||||
label=VPN
|
label=VPN
|
||||||
command=[ -e $BLOCK_INSTANCE ] && (echo "<span color='#00FF00'>ON</span>";) || (echo "<span color='#ffdd00'>OFF</span>";)
|
|
||||||
interval=5
|
interval=5
|
||||||
instance=/proc/sys/net/ipv4/conf/tun0
|
instance=wg0
|
||||||
markup=pango
|
markup=pango
|
||||||
|
|
||||||
# CPU usage
|
# CPU usage
|
||||||
|
14
scripts/i3blocks/vpn
Executable file
14
scripts/i3blocks/vpn
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
INSTANCE="${BLOCK_INSTANCE:-}"
|
||||||
|
|
||||||
|
# Check VPN status
|
||||||
|
GET_VPN=$(route | grep -E -- "tun0|$INSTANCE" | awk '{ print $NF }')
|
||||||
|
|
||||||
|
# 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
|
Loading…
x
Reference in New Issue
Block a user