Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Oct 12, 2021
1 parent 4f56cb1 commit 26d0412
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,24 @@ func main() {
}

func onReady() {
exepath, err := os.Executable()
if err != nil {
panic(err)
}
icon := filepath.Join(filepath.Dir(exepath), "on.png")
exepath, err := os.Executable()
if err != nil {
panic(err)
}
icon := filepath.Join(filepath.Dir(exepath), "on.png")

systray.SetIcon(iconOn)
mThisDevice := systray.AddMenuItem("This device:", "")
mNetworkDevices := systray.AddMenuItem("Network Devices", "")
mMyDevices := mNetworkDevices.AddSubMenuItem("My Devices", "")
mTailscaleServices := mNetworkDevices.AddSubMenuItem("Tailscale Services", "")
systray.AddSeparator()
systray.AddSeparator()
mExit := systray.AddMenuItem("Exit", "")
go func() {
<-mExit.ClickedCh
systray.Quit()
}()


go func() {
type Item struct {
menu *systray.MenuItem
Expand All @@ -58,7 +57,7 @@ func onReady() {
time.Sleep(10 * time.Second)
continue
}
myIP := strings.TrimSpace(string(b))
myIP := strings.TrimSpace(string(b))

b, err = exec.Command("tailscale", "status").CombinedOutput()
if err != nil {
Expand All @@ -79,10 +78,10 @@ func onReady() {
ip := fields[0]
title := fields[1]

if ip == myIP {
mThisDevice.SetTitle(fmt.Sprintf("This device: %s (%s)", title, ip))
continue
}
if ip == myIP {
mThisDevice.SetTitle(fmt.Sprintf("This device: %s (%s)", title, ip))
continue
}

var sub *systray.MenuItem
if strings.HasPrefix(title, "(") {
Expand Down

0 comments on commit 26d0412

Please sign in to comment.