wails
wails copied to clipboard
Is there an event to trap the hiding of the window?
Have you read the Documentation Contribution Guidelines?
- [X] I have read the Documentation Contribution Guidelines.
Description
I have an app that is represented by a systray icon.
The desired effect is that the wails window appears or disappears when the icon is clicked. I am also making use of HideWindowOnClose = true.
I also have a variable WindowVisible that keeps track of whether the window is visible or not. That way it knows what to do when the icon is clicked.
All works just fine until I close the windows with the X in the corner. Then the WindowVisible variable gets out of sync. A couple of clicks and it is back to normal. But I would like to fix this.
I have tried to use OnBeforeClose, but this only seems to work if HideWindowOnClose = false.
Is there an event I can trap that will allow me to update my variable when the window hides?
Self-service
- [ ] I'd be willing to address this documentation request myself.
There isn't currently an event fired for v2. v3 solves this issue be simply allowing you to attach a window to the systray and it acts as you've described.
https://github.com/wailsapp/wails/assets/1943904/022915c6-cfbe-499f-9627-7969dfbd0948
There isn't currently an event fired for v2. v3 solves this issue be simply allowing you to attach a window to the systray and it acts as you've described.
Is there an example that references this feature in v2.
Because I don't know how long v3 will have to wait