Browse Source

added tailscape

Hans Martin 3 years ago
parent
commit
a680a13e1a
2 changed files with 23 additions and 0 deletions
  1. 13 0
      .config/i3blocks/i3blocks.conf
  2. 10 0
      .scripts/i3/i3blocks/tailscale.sh

+ 13 - 0
.config/i3blocks/i3blocks.conf

@@ -10,6 +10,13 @@ markup=pango
 # See the script for details.
 
 # Guess the weather hourly
+
+[vpn-2]
+label=# of Devices:
+command=echo -n " " & tailscale status --active | wc -l
+interval=60
+
+
 [weather]
 command=curl -Ss 'https://wttr.in/munich?0&T&Q' | cut -c 16- | head -2 | xargs echo
 interval=3600
@@ -37,6 +44,12 @@ label=cpu
 interval=5
 command=$HOME/.scripts/i3/i3blocks/i3cpu.sh
 
+[vpn]
+label=VPN:
+#color=#ff5733
+command=$HOME/.scripts/i3/i3blocks/tailscale.sh
+interval=60
+#
 # Network interface monitoring
 [ip]
 label=IP:

+ 10 - 0
.scripts/i3/i3blocks/tailscale.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if tailscale status | grep -q "stopped"
+then
+    echo "<span foreground='#ff5733'> stopped</span>"
+else
+    ip=$(tailscale ip -4)
+    echo "<span foreground='#19c682'> $ip</span>"
+fi
+