Skip to content
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

Option to disable window re-focus when go app reloads #1495

Closed
sidwebworks opened this issue Jun 25, 2022 · 15 comments
Closed

Option to disable window re-focus when go app reloads #1495

sidwebworks opened this issue Jun 25, 2022 · 15 comments
Labels
Enhancement New feature or request

Comments

@sidwebworks
Copy link
Contributor

sidwebworks commented Jun 25, 2022

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.

image

@sidwebworks sidwebworks added the Enhancement New feature or request label Jun 25, 2022
@leaanthony
Copy link
Member

leaanthony commented Jun 25, 2022

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.

@sidwebworks
Copy link
Contributor Author

Agreed, sounds like a good way to go!

@leaanthony
Copy link
Member

Thinking more about this, it might not be possible as window managers are their own beasts...

@stale
Copy link

stale bot commented Nov 2, 2022

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.

@stale stale bot added the wont fix This will not be worked on label Nov 2, 2022
@leaanthony
Copy link
Member

@sidwebworks - how about we just not show the desktop app?

@leaanthony leaanthony removed the wont fix This will not be worked on label Nov 2, 2022
@sidwebworks
Copy link
Contributor Author

@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.

@leaanthony
Copy link
Member

My only worry about this is that people may use a library that works in a browser but is incompatible with webviews.

@birdmanmandbir
Copy link

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

@leaanthony
Copy link
Member

I'm happy to accept a PR if you have time to do it

@birdmanmandbir
Copy link

I'm happy to accept a PR if you have time to do it

Okay, I'll try it

@birdmanmandbir
Copy link

@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?

@birdmanmandbir
Copy link

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?

@leaanthony
Copy link
Member

Make it an option and you can read that at runtime.

@birdmanmandbir
Copy link

birdmanmandbir commented Jan 6, 2023

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?

@birdmanmandbir
Copy link

I made it complicated, seems I just need to add an option to options.App, and findout how to distinguish dev and build🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants