Adding Tailscale VPN
This commit is contained in:
parent
fa6599c2a9
commit
7ef93416fa
2 changed files with 20 additions and 5 deletions
|
@ -4,7 +4,22 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
executable = true;
|
executable = true;
|
||||||
text = ''
|
text = ''
|
||||||
tailscale status --json | jq -r '.BackendState'
|
#!/usr/bin/env bash
|
||||||
|
CLASS=`tailscale status --json | jq -r '.BackendState'`
|
||||||
|
# Known values: Running, Stopped
|
||||||
|
|
||||||
|
# Expected Output:
|
||||||
|
# {"text": "$text", "alt": "$alt", "tooltip": "$tooltip", "class": "$class", "percentage": $percentage }
|
||||||
|
# Different $Class depending on if TS is running or not
|
||||||
|
if [ $CLASS == "Running" ]; then
|
||||||
|
IP=`tailscale status --json | jq -r '.TailscaleIPs[0]'`
|
||||||
|
ALT="IP: $IP"
|
||||||
|
printf '{"class": %s", "alt": %s}' "$CLASS", "$ALT"
|
||||||
|
fi
|
||||||
|
if [ $CLASS == "Stopped" ]; then
|
||||||
|
ALT="Tailscale is not running"
|
||||||
|
printf '{"class": %s", "alt": %s}' "$CLASS", "$ALT"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"custom/tailscale": {
|
"custom/tailscale": {
|
||||||
"format": "VPN ",
|
"format": "{} ",
|
||||||
"exec": "echo '{\"class\": \"connected\"}'",
|
"exec": "$HOME/.config/waybar/scripts/tailscale.sh",
|
||||||
"exec-if": "",
|
"exec-if": "pgrep tailscaled",
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"interval": 5
|
"interval": 5
|
||||||
},
|
},
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
/* new stuff */
|
/* new stuff */
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
color: rgba(50, 48, 47, 0.8);
|
color: rgba(50, 48, 47, 0.8);
|
||||||
background-color: #e2cca9;
|
background-color: #d5c4a1;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue