Skip to content

Instantly share code, notes, and snippets.

@notpushkin
Created November 19, 2022 08:56
Show Gist options
  • Save notpushkin/aa36c2d34e3e7180aa66ed2a589afe05 to your computer and use it in GitHub Desktop.
Save notpushkin/aa36c2d34e3e7180aa66ed2a589afe05 to your computer and use it in GitHub Desktop.
Tailscale GUI but it's an xbar app https://news.ycombinator.com/item?id=33650730
#!/bin/bash
# WTFPL
tsp=(/opt/homebrew/bin/tailscale --socket ~/.tailscaled.socket)
jq() {
/opt/homebrew/bin/jq "$@"
}
status_json="$("${tsp[@]}" status --json)"
echo "ts"
echo "---"
if [[ "$(echo "${status_json}" | jq -r .Self.Online)" = "true" ]]; then
echo "Connected | disabled=true"
echo "Log out | shell=bash | param1=-c | param2='${tsp[*]} down'"
echo "---"
echo "Admin console... | href=https://login.tailscale.com/welcome"
echo "---"
echo "This Device | disabled=true"
echo "$(echo "${status_json}" | jq -r .Self.HostName) – $(echo "${status_json}" | jq -r .Self.TailscaleIPs[0]) | shell=bash | param1=-c | param2='echo -n \"$(echo "${status_json}" | jq -r .Self.TailscaleIPs[0])\" | pbcopy'"
# echo "---"
# echo "Available Devices | disabled=true"
# echo "TODO... | disabled=true"
else
echo "Disconnected | disabled=true"
echo "Sign in... | shell=bash | param1=-c | param2='${tsp[*]} up'"
echo "---"
echo "Admin console... | href=https://login.tailscale.com/welcome"
# echo "---"
# echo "Sign in to see device list | disabled=true"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment