wails
wails copied to clipboard
Option to disable window re-focus when go app reloads
Is your feature request related to a problem? Please describe.
The default behaviour of Wails is when your backend (Go) side code changes, the app reloads so it closes, reopens and focuses itself again in the desktop view.
The is not a plesant experience if using the browser for primarily developing the app and don't want it to pop up again and again during development changes.
Describe the solution you'd like
It would be nice if we could add an option inside the wails.config by the name of something like
focusWindowOnReload: false
depending on this we can change the behaviour.
Describe alternatives you've considered
Some yoga can help to deal with the frustration during development reloads. 😄
Additional context
After talking to @leaanthony on slack I got to know that this was indeed the default behaviour previously but lost in time lol.
Now that we have WebKit by default across the platforms, the previous frustrations with apps working differently in the browser and app may be reduced, so I think this is a valid option.
It's only relevant to Dev mode so should be a cli flag, and be saved to wails.json as a default preference.
Agreed, sounds like a good way to go!
Thinking more about this, it might not be possible as window managers are their own beasts...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@sidwebworks - how about we just not show the desktop app?
@leaanthony I think that would work, so if the user wants to work with the UI they can just open the browser or turn the option off.
My only worry about this is that people may use a library that works in a browser but is incompatible with webviews.
My only worry about this is that people may use a library that works in a browser but is incompatible with webviews.
When will this be implemented? The Re-Focus is really distracting for me.. To avoid using a incompatible library, I can check it periodically by build a executable
I'm happy to accept a PR if you have time to do it
I'm happy to accept a PR if you have time to do it
Okay, I'll try it
@sidwebworks - how about we just not show the desktop app?
I have add a flag to wails dev, but how do I make the desktop app not to show? Maybe I need to find the window manager and disable it during the process of build?
I have known how to make the desktop app not to show, but I'm not sure how to read the cli flag in the application, for they are two different processes Can I use the conditional compilation?
Make it an option and you can read that at runtime.
Make it an option and you can read that at runtime.
Do u mean wails.json?
The option could be configured in wails.json, and will also be written to wails.json when run wails dev -nodesktop, am I correct?
But how to disable this option in wails build? Is there anyway except the conditional compilation?
I made it complicated, seems I just need to add an option to options.App, and findout how to distinguish dev and build🤣