aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/i3blocks/vpn
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-03-25 23:11:14 -0500
committerJesús <heckyel@hyperbola.info>2021-03-25 23:11:14 -0500
commitbe12a6b78c0cee203e4cc9c0a74cffce820c2bdd (patch)
treeb397f4fdaaf14f67fcf12f976c03c29d4f940857 /scripts/i3blocks/vpn
parentd971de136771ce6aa3d2fb59fa0ac1bd5c3a5f71 (diff)
downloadi3-config-be12a6b78c0cee203e4cc9c0a74cffce820c2bdd.tar.lz
i3-config-be12a6b78c0cee203e4cc9c0a74cffce820c2bdd.tar.xz
i3-config-be12a6b78c0cee203e4cc9c0a74cffce820c2bdd.zip
Add support VPN for OpenVPN and WireGuard
Diffstat (limited to 'scripts/i3blocks/vpn')
-rwxr-xr-xscripts/i3blocks/vpn14
1 files changed, 14 insertions, 0 deletions
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