@ -199,14 +199,14 @@ func (menu *Menu) rebuild() {
case ipn . Running . String ( ) :
case ipn . Running . String ( ) :
if menu . status . ExitNodeStatus != nil && ! menu . status . ExitNodeStatus . ID . IsZero ( ) {
if menu . status . ExitNodeStatus != nil && ! menu . status . ExitNodeStatus . ID . IsZero ( ) {
if menu . status . ExitNodeStatus . Online {
if menu . status . ExitNodeStatus . Online {
systray . SetTitle ( "Using exit node" )
setTooltip ( "Using exit node" )
setAppIcon ( exitNodeOnline )
setAppIcon ( exitNodeOnline )
} else {
} else {
systray . SetTitle ( "Exit node offline" )
setTooltip ( "Exit node offline" )
setAppIcon ( exitNodeOffline )
setAppIcon ( exitNodeOffline )
}
}
} else {
} else {
systray . SetTitle ( fmt . Sprintf ( "Connected to %s" , menu . status . CurrentTailnet . Name ) )
setTooltip ( fmt . Sprintf ( "Connected to %s" , menu . status . CurrentTailnet . Name ) )
setAppIcon ( connected )
setAppIcon ( connected )
}
}
menu . connect . SetTitle ( "Connected" )
menu . connect . SetTitle ( "Connected" )
@ -214,10 +214,10 @@ func (menu *Menu) rebuild() {
menu . disconnect . Show ( )
menu . disconnect . Show ( )
menu . disconnect . Enable ( )
menu . disconnect . Enable ( )
case ipn . Starting . String ( ) :
case ipn . Starting . String ( ) :
systray . SetTitle ( "Connecting" )
setTooltip ( "Connecting" )
setAppIcon ( loading )
setAppIcon ( loading )
default :
default :
systray . SetTitle ( "Disconnected" )
setTooltip ( "Disconnected" )
setAppIcon ( disconnected )
setAppIcon ( disconnected )
}
}
@ -312,6 +312,16 @@ func setRemoteIcon(menu *systray.MenuItem, urlStr string) {
}
}
}
}
// setTooltip sets the tooltip text for the systray icon.
func setTooltip ( text string ) {
if runtime . GOOS == "darwin" || runtime . GOOS == "windows" {
systray . SetTooltip ( text )
} else {
// on Linux, SetTitle actually sets the tooltip
systray . SetTitle ( text )
}
}
// eventLoop is the main event loop for handling click events on menu items
// eventLoop is the main event loop for handling click events on menu items
// and responding to Tailscale state changes.
// and responding to Tailscale state changes.
// This method does not return until ctx.Done is closed.
// This method does not return until ctx.Done is closed.