Commit Diff


commit - 643580cdd1c75b42b3f58857d8f7aa368943ccbc
commit + 8c86d84df89ce470854f578c411831910a82208a
blob - 795fcc62f5110f0c74cf77c8a669dc3043e799f5
blob + a68db00c6bd63a1b4afa2a9125ea5d6be5a9b67d
--- .config/spectrwm/baraction.sh
+++ .config/spectrwm/baraction.sh
@@ -1,9 +1,9 @@
-#   _                          _   _                   _
-#  | |__   __ _ _ __ __ _  ___| |_(_) ___  _ __    ___| |__
-#  | '_ \ / _` | '__/ _` |/ __| __| |/ _ \| '_ \  / __| '_ \
+#   _                          _   _                   _     
+#  | |__   __ _ _ __ __ _  ___| |_(_) ___  _ __    ___| |__  
+#  | '_ \ / _` | '__/ _` |/ __| __| |/ _ \| '_ \  / __| '_ \ 
 #  | |_) | (_| | | | (_| | (__| |_| | (_) | | | |_\__ \ | | |
 #  |_.__/ \__,_|_|  \__,_|\___|\__|_|\___/|_| |_(_)___/_| |_|
-#
+#                                                            
 
 #!/bin/sh
 
@@ -45,6 +45,22 @@ print_cpuspeed() {
   printf "CPU speed: %4d MHz  " $CPU_SPEED
 }
 
+print_ip() {
+  IP=`ifconfig wg0 | grep "inet " | grep -v 127.0.0.1 | cut -d\  -f2`
+
+  # Print IP.
+  printf "+@fg=1;"
+  if [ -z $IP ]; then
+    printf "+@fg=3;"
+    printf "No VPN"
+  elif [ ! -z $IP ]; then
+    printf "VPN"
+  fi
+
+  # Reset colour.
+  printf "+@fg=3;"
+}
+
 print_volume() {
   VOLUME=`/usr/bin/sndioctl -n output.level`
   # Convert value to percentage.
@@ -119,6 +135,8 @@ while :; do
   #print_mem
   #print_cpu $IOSTAT_DATA
   #print_cpuspeed
+  print_ip
+  printf " | "
   print_volume
   printf "| "
   print_bat $APM_DATA