Skip to content

systray crashes on macOS due to dual NSApplication run loops #11

@ehsaniara

Description

@ehsaniara

Egressor crashes with SIGTRAP: trace trap on macOS when the system tray
is enabled alongside the Wails desktop UI.

The root cause is that systray.Run() starts its own NSApplication run
loop in a goroutine, while Wails already owns the main thread. macOS
requires all UI work to happen on a single main thread — two competing
run loops cause a fatal signal.

Stack trace points to:

  • github.com/energye/systray._Cfunc_nativeLoop() (goroutine 7)
  • github.com/wailsapp/wails/v2/...darwin._Cfunc_RunMainLoop() (goroutine 1, main thread)

The fix is to use systray.Register() instead of systray.Run().
Register() sets up the tray icon and menus but lets the existing run
loop (Wails) handle events, avoiding the conflict.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions