diff options
author | Jesús <heckyel@hyperbola.info> | 2021-03-25 23:11:14 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-03-25 23:11:14 -0500 |
commit | be12a6b78c0cee203e4cc9c0a74cffce820c2bdd (patch) | |
tree | b397f4fdaaf14f67fcf12f976c03c29d4f940857 | |
parent | d971de136771ce6aa3d2fb59fa0ac1bd5c3a5f71 (diff) | |
download | i3-config-be12a6b78c0cee203e4cc9c0a74cffce820c2bdd.tar.lz i3-config-be12a6b78c0cee203e4cc9c0a74cffce820c2bdd.tar.xz i3-config-be12a6b78c0cee203e4cc9c0a74cffce820c2bdd.zip |
Add support VPN for OpenVPN and WireGuard
-rw-r--r-- | i3blocks.conf | 3 | ||||
-rwxr-xr-x | scripts/i3blocks/vpn | 14 |
2 files changed, 15 insertions, 2 deletions
diff --git a/i3blocks.conf b/i3blocks.conf index b0dd24b..4a137cd 100644 --- a/i3blocks.conf +++ b/i3blocks.conf @@ -104,9 +104,8 @@ interval=5 [vpn] label=VPN -command=[ -e $BLOCK_INSTANCE ] && (echo "<span color='#00FF00'>ON</span>";) || (echo "<span color='#ffdd00'>OFF</span>";) interval=5 -instance=/proc/sys/net/ipv4/conf/tun0 +instance=wg0 markup=pango # CPU usage diff --git a/scripts/i3blocks/vpn b/scripts/i3blocks/vpn new file mode 100755 index 0000000..d701056 --- /dev/null +++ b/scripts/i3blocks/vpn @@ -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 |