Skip to content

Creating more than one tray icon is not possible? #137

@arisudesu

Description

@arisudesu

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, 0x0, 0x0, 0x0, 0x0, 0x0, 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0, 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/walk@v0.0.0-20250702155327-6376defdac3f/error.go:81
github.com/tailscale/walk.newError({0xc000150000, 0xa39})
	D:/GO/gopath/pkg/mod/github.com/tailscale/walk@v0.0.0-20250702155327-6376defdac3f/error.go:85 +0x25
github.com/tailscale/walk.lastError({0xc000150000, 0xa39})
	D:/GO/gopath/pkg/mod/github.com/tailscale/walk@v0.0.0-20250702155327-6376defdac3f/error.go:97 +0xae
github.com/tailscale/walk.(*niCmd).execute(0xc000004808)
	D:/GO/gopath/pkg/mod/github.com/tailscale/walk@v0.0.0-20250702155327-6376defdac3f/notifyicon.go:485 +0x216
github.com/tailscale/walk.newShellNotificationIcon(0x0)
	D:/GO/gopath/pkg/mod/github.com/tailscale/walk@v0.0.0-20250702155327-6376defdac3f/notifyicon.go:296 +0xdc
github.com/tailscale/walk.newNotifyIcon(0xc00001a0e0?)
	D:/GO/gopath/pkg/mod/github.com/tailscale/walk@v0.0.0-20250702155327-6376defdac3f/notifyicon.go:546 +0x17
github.com/tailscale/walk.NewNotifyIcon(...)
	D:/GO/gopath/pkg/mod/github.com/tailscale/walk@v0.0.0-20250702155327-6376defdac3f/notifyicon.go:531
main.main()
	D:/PROJECTS/traycmd/repro/main.go:21 +0xbf

Process finished with the exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions