fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.14k stars 1.4k forks source link

Ability to Quit Systray Application with Keybind #3536

Open Beebeeoii opened 1 year ago

Beebeeoii commented 1 year ago

Checklist

Is your feature request related to a problem?

I am unsure if there is a way around this. What I am trying to achieve is to have cmd q quit the application which has a close interceptor set. I require the close interceptor as I would like to hide the main window and minimise it to systray when users click on the close button.

However, by convention on macOS, cmd q should close the application even if the close interceptor overrides and simply hides the window. Is there any way to work around this?

Thanks !

Is it possible to construct a solution with the existing API?

No response

Describe the solution you'd like to see.

To be able to listen to keybinds in the close interceptor so that when user executes cmd q, i can call app.Close()

andydotxyz commented 4 months ago

Coming back to this because the way that system tray handles windows changed a little. A quit call should still call the window callbacks in case there is unsaved work.

I guess you could listen to the key combination on your window canvases - or add a custom Quit menu item that calls your own function. I think either of these should work now - can you confirm @Beebeeoii ?