aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/i3blocks/vpn
diff options
context:
space:
mode:
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