-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminating process leaves icon visible #237
Comments
This sounds like your application is not handling Ctrl-C and performing cleanup, but I could be wrong. Killing the app with VSCode will also not let the app do any cleanup it needs to do. Any time you unceremoniously kill an app that has an icon in the system tray, the icon will get left behind; at least that's my experience. |
That is exactly correct - I guess you're saying that systray won't tidy up after itself - and the example code in the Readme.md also has the same issue (I think). Could/should systray maybe handle an OS Interrupt and exit gracefully? |
I tried adding a handler for Ctrl C - see below (modified from https://golangcode.com/handle-ctrl-c-exit-in-terminal/). The output after hitting Ctrl-C in the command line shows (correctly) I then checked quitting through the systray menu - and the icon only disappears if I happen to have the mouse over the icon at the time...so this doesn't seem to work either. Any help/suggestions please?
|
Solved - I added a 1 second delay after systray.Quit() before closing everything else down - and the icon disappears correctly...i.e. after menu quitting and after Ctrl-C. So it looks like systray.Quit() doesn't get enough time to tidy up if you just exit the application. Possibly this could be fixed by making it return only when the icon has been removed (?). Still doesn't work when VSCode halts and then kills the application - but I can live with that :) |
(Run on Win 11)
When I terminate the go application - the tray icon is left visible in the sys tray (possibly off screen) and will remain there until mouse over - it then disappears. This happens when:
If I run the application several times and keep restarting, a new icon is generated every time - where only the latest one is a valid running application.
Note: this is not to do with properly exited (quit) applications - which works fine - but when the process is terminated, it seems the icon is not tidied up.
The text was updated successfully, but these errors were encountered: