This commit is contained in:
iFargle 2023-08-28 20:44:27 +09:00
parent 5974bd496c
commit 98ae22b400
2 changed files with 9 additions and 6 deletions

View file

@ -6,7 +6,6 @@
text = ''
#!/usr/bin/env bash
CLASS=`tailscale status --json | jq -r '.BackendState'`
TEXT="󰌆"
# Known values: Running, Stopped
# Expected Output:
@ -14,12 +13,12 @@
# 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 '{"text": "%s", "class": "%s", "alt": "%s"}\n' "$TEXT" "$CLASS" "$ALT"
TOOLTIP="IP: $IP"
printf '{"class": "%s", "tooltip": "%s"}\n' "$CLASS" "$TOOLTIP"
fi
if [ $CLASS == "Stopped" ]; then
ALT="Tailscale is not running"
printf '{"text": "%s", "class": "%s", "alt": "%s"}\n' "$TEXT" "$CLASS" "$ALT"
TOOLTIP="Tailscale is not running"
printf '{"class": "%s", "tooltip": "%s"}\n' "$CLASS" "$TOOLTIP"
fi
'';
};

View file

@ -43,6 +43,10 @@
"exec-if": "pgrep tailscaled",
"return-type": "json",
"interval": 5
format-icons = {
"Running" = "󰌆",
"Stopped" = "󰌊",
}
},
"idle_inhibitor": {
@ -215,7 +219,7 @@
#battery.critical,
#custom-tailscale.Stopped,
#network.disconnected {
background-color: #fe8019;
background-color: #f2594b;
}
#battery.charging {
color: #98971a;