walk icon indicating copy to clipboard operation
walk copied to clipboard

Creating more than one tray icon is not possible?

Open arisudesu opened this issue 3 months ago • 0 comments

This is a minimal reproduction program. It fails with the following error while attempting to create a second icon. Env is: Windows 10 (desktop edition), Go 1.25.0.

I doubt that there are limitations in Windows, because other apps do it here and there all the time. Perhaps, an error in walk?

package main

import (
	"log"

	"github.com/tailscale/walk"
)

func main() {
	app, err := walk.InitApp()
	if err != nil {
		log.Fatal(err)
	}

	ni, err := walk.NewNotifyIcon()
	if err != nil {
		log.Fatal(err)
	}
	defer ni.Dispose()

	ni2, err := walk.NewNotifyIcon()
	if err != nil {
		log.Fatal(err)
	}
	defer ni2.Dispose()

	app.Run()
}
module win_test

go 1.25

require (
	github.com/tailscale/walk v0.0.0-20250702155327-6376defdac3f
)
2025/10/15 11:01:00 Shell_NotifyIcon(0, win.NOTIFYICONDATA{CbSize:0x3d0, HWnd:0x7050a, UID:0x0, UFlags:0x9, UCallbackMessage:0x403, HIcon:0x0, SzTip:[128]uint16{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0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0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, UVersion:0x0, SzInfoTitle:[64]uint16{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, DwInfoFlags:0x0, GuidItem:syscall.GUID{Data1:0x0, Data2:0x0, Data3:0x0, Data4:[8]uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, HBalloonIcon:0x0})

Stack:
goroutine 1 [running, locked to thread]:
runtime/debug.Stack()
	D:/GO/go1.25.0/src/runtime/debug/stack.go:26 +0x5e
github.com/tailscale/walk.newErr(...)
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/error.go:81
github.com/tailscale/walk.newError({0xc000150000, 0xa39})
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/error.go:85 +0x25
github.com/tailscale/walk.lastError({0xc000150000, 0xa39})
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/error.go:97 +0xae
github.com/tailscale/walk.(*niCmd).execute(0xc000004808)
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/notifyicon.go:485 +0x216
github.com/tailscale/walk.newShellNotificationIcon(0x0)
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/notifyicon.go:296 +0xdc
github.com/tailscale/walk.newNotifyIcon(0xc00001a0e0?)
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/notifyicon.go:546 +0x17
github.com/tailscale/walk.NewNotifyIcon(...)
	D:/GO/gopath/pkg/mod/github.com/tailscale/[email protected]/notifyicon.go:531
main.main()
	D:/PROJECTS/traycmd/repro/main.go:21 +0xbf

Process finished with the exit code 1

arisudesu avatar Oct 15 '25 08:10 arisudesu