summaryrefslogtreecommitdiff
path: root/home/wayland/pkgs/wayland-scripts/src/bin/vpn
blob: db0353a5261a2256de556641f49c1db5b31620a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

exit_node="${1:-kay}"

note()
{
	command -v notify-send > /dev/null &&
		notify-send "󰒒  vpn" "$1"
	printf "%s\n" "$1"
}

if tailscale exit-node list | grep -q "selected"; then
	tailscale set --exit-node= &&
		note "Connection was dropped"

else
	tailscale set --exit-node="$exit_node" &&
		note "Traffic routed through $exit_node"
fi