From 83005be066de63f70141cdc7443f7885c34bb300 Mon Sep 17 00:00:00 2001 From: Aram Date: Mon, 26 May 2025 12:03:37 +0100 Subject: [PATCH] [V3] Update systray.mdx example (#4307) * Update systray.mdx GUI operations must run on the main thread I guess? this example calling systray.Run() from a non-main thread context and it will panic. * Update systray.mdx OnClick function takes *application.Context. the example if not complete --- docs/src/content/docs/learn/systray.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/content/docs/learn/systray.mdx b/docs/src/content/docs/learn/systray.mdx index 7655cab78..01c32ac08 100644 --- a/docs/src/content/docs/learn/systray.mdx +++ b/docs/src/content/docs/learn/systray.mdx @@ -18,7 +18,7 @@ app := application.New(options) systray := app.NewSystemTray() systray.SetLabel("My App") systray.SetIcon(iconBytes) -systray.Run() +app.Run() ``` ## Setting the Icon @@ -85,10 +85,10 @@ You can add a menu to your system tray icon: ```go menu := application.NewMenu() -menu.Add("Open").OnClick(func() { +menu.Add("Open").OnClick(func(ctx *application.Context) { // Handle click }) -menu.Add("Quit").OnClick(func() { +menu.Add("Quit").OnClick(func(ctx *application.Context) { app.Quit() }) @@ -133,7 +133,7 @@ menu.Add("Quit").OnClick(func() { }) systray.SetMenu(menu) -systray.Run() +app.Run() ``` ## Icon Position