Compare commits

...

2 commits

Author SHA1 Message Date
043e96f93e Add quick switching for tailscale exit nodes 2025-03-26 20:26:54 -04:00
90ef5ff1c5 Add mpv window rule 2025-03-16 18:26:17 -04:00
2 changed files with 21 additions and 3 deletions

View file

@ -54,13 +54,15 @@ function sshunlock() {
# Show a menu of all known Tailscale nodes for the user to select from
function tsselect() {
local jq_filter="$1"
[ -z "$jq_filter" ] && jq_filter=".Peer[] | .DNSName"
local items=()
while read -r line; do
[ -z "$line" ] && continue
[[ "$line" =~ ^\# ]] && continue
local name=$(echo "$line" | awk '{ print $2 }')
items+=("$name")
done <<< $(tailscale status --self=false | sort -k 2)
items+=("$line")
done <<< $(tailscale status -json | jq -r "$jq_filter" | sort)
_COLUMNS=$COLUMNS
# Force options to display in one column
@ -142,6 +144,17 @@ function moshwezscrts() {
moshwez $(tsselect) -- screen -RR -d
}
# Switch tailscale exit nodes
function tsexit() {
echo "Current exit node: $(tailscale status -json | jq -r ".Peer[] | select(.ExitNode == true) | .DNSName")"
local newsel="$(tsselect ".Peer[] | select(.ExitNodeOption == true) | .DNSName")"
[ -z "$newsel" ] || sudo tailscale set --exit-node="$newsel" --exit-node-allow-lan-access=true
}
function tsnoexit() {
sudo tailscale set --exit-node="" --exit-node-allow-lan-access=false
}
# Add local to path
export PATH="$PATH:~/.local/bin"

View file

@ -46,3 +46,8 @@ window-rule {
match is-active=false
opacity 0.98
}
window-rule {
match app-id=r#"mpv$"#
default-column-width { proportion 0.9; }
}