wails icon indicating copy to clipboard operation
wails copied to clipboard

Option to disable window re-focus when go app reloads

Open sidwebworks opened this issue 3 years ago • 3 comments

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 avatar Jun 25 '22 21:06 sidwebworks

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.

leaanthony avatar Jun 25 '22 22:06 leaanthony

Agreed, sounds like a good way to go!

sidwebworks avatar Jun 26 '22 00:06 sidwebworks

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

leaanthony avatar Jul 21 '22 12:07 leaanthony

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[bot] avatar Nov 02 '22 02:11 stale[bot]

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

leaanthony avatar Nov 02 '22 08:11 leaanthony

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

sidwebworks avatar Nov 02 '22 14:11 sidwebworks

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

leaanthony avatar Nov 02 '22 20:11 leaanthony

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

birdmanmandbir avatar Jan 03 '23 12:01 birdmanmandbir

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

leaanthony avatar Jan 03 '23 19:01 leaanthony

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

Okay, I'll try it

birdmanmandbir avatar Jan 04 '23 14:01 birdmanmandbir

@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 avatar Jan 04 '23 15:01 birdmanmandbir

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?

birdmanmandbir avatar Jan 04 '23 17:01 birdmanmandbir

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

leaanthony avatar Jan 04 '23 18:01 leaanthony

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 avatar Jan 06 '23 12:01 birdmanmandbir

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

birdmanmandbir avatar Jan 06 '23 14:01 birdmanmandbir