Running a systray app in debugger doesn't show a menu ( running an app bundle of the same binary does ) #69
-
I have a very simple systray app. After building it on MacOS ( Sonoma 14.1.2 (23B2091) arm64, go 1.21.4 ) But when trying to run/debug this executable with VisualStudio Code ( using delve ) the program starts up, I can set breakpoints and they are hit, BUT I don't see any menu ? Is there anything special that needs to be done, to be able to run a systray app in a debugger session ? package main
import (
"fmt"
"fyne.io/systray"
)
func main() {
systray.Run(onReady, onExit)
}
func onReady() {
systray.SetIcon(IconData)
systray.SetTitle("Awesome App")
systray.SetTooltip("Tooltip")
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
mQuit.SetIcon(IconData)
go func() {
<-mQuit.ClickedCh
fmt.Println("Requesting quit")
systray.Quit()
fmt.Println("Finished quitting")
}()
// strange: adding a breakpoint on next line shows a somewhat "broken" menu,
// I can see some portion of the icon, but nothing more, no text.
// And continuing the debug run makes that artifact vanish and I don't see any menu/icon anymore.
fmt.Println("onReady done")
}
func onExit() {
fmt.Println("onExit done")
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I don't know how a debugger can change the behaviour of your app like this. |
Beta Was this translation helpful? Give feedback.
-
The same happens when I just run the plain executable ( i.e. not the app bundle ). There is no menu entry shown, but on the console I can see output "onReady" from the program. Double click and run |
Beta Was this translation helpful? Give feedback.
-
Oh, man. That is really embarrassing. The reason I don't see the menu of the plain executable running or when the debugger is running is simply because there is no more room for any new menu-item on my screen. As soon as I fiddled with system settings to have less active menus I can see the menu of my running program :-) |
Beta Was this translation helpful? Give feedback.
Oh, man. That is really embarrassing. The reason I don't see the menu of the plain executable running or when the debugger is running is simply because there is no more room for any new menu-item on my screen.
It turns out that my 14.2" display has not enough space to hold all the menus that are active when I'm using Visual Studio Code ( and running an executable from within the console of Visual Studio Code ).
As soon as I fiddled with system settings to have less active menus I can see the menu of my running program :-)
@andydotxyz Thank you for your feedback, it made me rethink about this strange behavior.