28 lines
		
	
	
		
			547 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			547 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
case $BLOCK_BUTTON in
 | 
						|
	1) ~/.dotfiles/bin/rofi-tscale ;;
 | 
						|
esac
 | 
						|
 | 
						|
text="   "
 | 
						|
 | 
						|
exitnode=$(tailscale status --json | jq .ExitNodeStatus)
 | 
						|
enstatus=""
 | 
						|
tsip=$(ip a show tailscale0 | rg "inet (\d+\.\d+\.\d+\.\d+)" -or '$1')
 | 
						|
[ "$exitnode" = "null" ] && {
 | 
						|
	[ -z "$tsip" ] && {
 | 
						|
		text="$text offline"
 | 
						|
		color='#707070'
 | 
						|
	} || {		
 | 
						|
		text="$text $tsip"
 | 
						|
		COLOR='#8080ff'
 | 
						|
	}
 | 
						|
} || {
 | 
						|
	enstatus=$(echo $exitnode | jq .TailscaleIPs.[0] | sed 's/"//g' | cut -d'/' -f1)
 | 
						|
	text="$text exit: $enstatus"
 | 
						|
	COLOR='#80ff80'
 | 
						|
}
 | 
						|
echo $text
 | 
						|
echo $text
 | 
						|
echo $COLOR
 |