Closed leaanthony closed 1 year ago
Can you also support custom dialog windows as an HTML
? So that the dialog windows will all match with the application
window theme which is already styled in HTML
and CSS
?
Hey @KiddoV - what's driving this requirement? Is it Webview2 showing light dialogs in dark mode? That's a known bug on their end. If not, please open another ticket so we don't mix up the conversation π
@leaanthony no, I was just wondering if we can have a way to customize the dialog boxes like a message box using CSS
and HTML
. With the help of Wails
, we build the app main window with full of HTML
and CSS
, so , calling a dialog box with the default OS theme
seem a bit ...odd.
So, instead of: This looks better, don't you think?
I know, I know... that I can make a modal
within the webview
window and call it done, but having a separate dialog window would be awesome.
Some people wouldn't agree π but having the option is good.
+1 one app need Multiple Windows
Yes, this would unlock the true potential of wails. πͺ I discovered wails today and super pumped to learn and create. Thanks for this excellent effort.
genuinely looking forward to this, something like this would be a lifesaver especially for a screenshotting tool
ζεΎ ζ―ζε€ηͺε£
To support multiple windows, I'm treating each window as a different executable.
My project structure looks like this
--MyApp
--splash.exe //Splash screen. After 5 seconds this screen is automatically closed and the projects screen is opened
--projects.exe //Screen to list saved projects. When a project is selected, the project editing screen opens
--editor.exe //Playground to edit a project
1 - The screens are opened via cmd inside the executables. 2 - With the flag library it is possible to pass custom parameters before execution.
path, _ := os.Getwd()
cmd := exec.Command(path+"\\editor.exe", "-project=xxxx")
...
This is a simple and limited solution, but it suits my use case.
@santanamic Why didn't I think of this! :)
I tried this just now in my Mac and realised that this created two apps in the taskbar. For example:
Do you have a way to make it not do this?
@santanamic To give context, this is what I did to the template app. Please ignore the messy code; it is written to confirm my understanding.
// Greet returns a greeting for the given name
func (a *App) Greet(name string) string {
dir, err := os.Getwd()
if err != nil {
fmt.Println(err.Error())
}
fmt.Println("directory=", dir)
err = exec.Command(dir + "/kuit").Run()
if err != nil {
fmt.Println(err.Error())
}
return fmt.Sprintf("Hello %s, It's show time!", name)
}
@aneeskA You can open a native webview window.
<a href="#" id="open-popup">open popup</a>
(() => { let id = document.getElementById("open-popup"); id.addEventListener("click", function(event){ let popupWindow = window.open("", 'myWindow', "width=800,height=500,left=283,top=134,location=no,menubar=no,scrollbars=no,resizable=no,status=no,titlebar=no,toolbar=no"); popupWindow.document.write("<html><body>123...</body></html>"); }); })();
The problem is the fixed URL bar
window.open accepts some parameters. Most unfortunately don't work.
@santanamic Why didn't I think of this! :)
I tried this just now in my Mac and realised that this created two apps in the taskbar. For example:
Do you have a way to make it not do this?
You can also reopen the current window. π
cmd := exec.Command(path+"\self.exe", "-screen=editor")
The screen argument must receive the name of the view and do the proper logic for execution.
This way it is possible to work with only 1 executable.
I hadn't noticed this simplicity. I believe Multiple Windows support can be based on this? @leaanthony
@aneeskA Please if this runs successfully on the mec let me know.
Great workaround π Multiple window support will allow more than 1 window to be displayed at once. Is there any reason you prefer to relaunch the app instead of just swapping out the view?
Great workaround π Multiple window support will allow more than 1 window to be displayed at once. Is there any reason you prefer to relaunch the app instead of just swapping out the view?
I need for the following components
1 - Home screen/Splash screen
2 - Custom Dialogs, Configuration Forms and a Log Console
3 - Open a custom HTML outside the main editor
@aneeskA Please if this runs successfully on the mec let me know.
I just now tried it and it is not working as we expected in my Mac.
Great workaround π Multiple window support will allow more than 1 window to be displayed at once. Is there any reason you prefer to relaunch the app instead of just swapping out the view?
I am not sure if I understood "swapping out the view", but for me I need multiple windows to be able to do separate but related things in different windows something like a browser allows me to do. Put different but related stuff side by side to analyse data.
This would be great. I think all I really need is a way to open a window with window options that opens to a particular HTML file. A way to control the window would be good too (close it, move it, hide it, etc).
I'd mainly be using these for displaying logs alongside the main application, giving the user a way to provide more information (like a form), and customize the main app (like an options pane).
I think it'll be useful if windows have access to other windows, so for example the new window could change what the main window is doing.
I want to have two web views in one window, allowing me to show an external website. Many sites block iframe usage, and I assume that's true with something like Wails.
I have two use cases. One use case is a live-reload app that will run a Go web app and rebuild, then reload it when something changes. This is possible with an iframe but doesn't allow me to read things like the page title or to use JavaScript to reload the page. The workaround is to use a reverse proxy. The other is a hacker news client, where I'd like to show the comments with the linked external website.
I can move this comment elsewhere if this is out of scope for Multi-Windows.
@mholt - I think this will be fairly trivial once we refactor out the current window code and make it more programmatic, as per the system tray API. I imagine this being something like:
logWindow := application.NewWindow(...)
// Store wherever you want
logWindow.Resize() // etc
@SamHennessy I'd make that a different request. I think you're wanting more flexibility around containers within the same window?
I have another use case. I am pushing windows to another embedded wayland compositor and I would like to share state between them in goland. Multiple windows could allow me to manage everything from a single runtime.
I could use a single view but I will need to manage window properties and focus as there are other wayland surfaces that are rendering other applications..
So I want to port a web app I was working on to Wails. One of my use cases is the ability to enter markdown in text areas. But I also provide the ability to edit the markdown in a full blown editor window that launches as a separate named tab and writes the result to local storage and sends a closed event to the launching tab when done. Then the launching tab fetches the modified markdown and replaces the text area with the new markdown. Being able to launch a separate editor window that allows communication between the two windows would be fantastic.
Hey @steowens - this is absolutely happening but be aware that the current API is really geared around 1 window, and that affects everything. For multiple windows, there will unavoidably be an API change but that's a good thing! I have some exciting things to announce soon so stick around π
support multiple windows +1
Please Support multiple Windows:
import useChildWindow from "../wailsjs/go/main/App.js";
// the window uses a piniaStore for data exchange
let details = useChildWindow('details.vue', windowOptions);
function onShowDetails() {
details.show();
}
PLZ Support multiple Windows:
import useChildWindow from "../wailsjs/go/main/App.js"; // the window uses a piniaStore for data exchange let details = useChildWindow('details.vue', windowOptions); function onShowDetails() { details.show(); }
What's PLT?
PLZ Support multiple Windows:
import useChildWindow from "../wailsjs/go/main/App.js"; // the window uses a piniaStore for data exchange let details = useChildWindow('details.vue', windowOptions); function onShowDetails() { details.show(); }
What's PLT?
I think you mean PLZ? PLZ is please in internet slang
PLZ Support multiple Windows:
import useChildWindow from "../wailsjs/go/main/App.js"; // the window uses a piniaStore for data exchange let details = useChildWindow('details.vue', windowOptions); function onShowDetails() { details.show(); }
What's PLT?
I think you mean PLZ? PLZ is please in internet slang
haha~,Thank you!
May I ask if there are any new developments?
A year has passed unknowingly.
Multiple windows is in v3. If anyone is interested in any updates on this then please feel free to join the discord server. This was a video made 6 months ago as a little demo. If you want to see the source code, just press pause and rewind to the start.
https://github.com/wailsapp/wails/assets/1943904/a9f92cbe-af23-4034-aa75-20c913b7f2e4
Is there a popout into second window feature planned? e.g. a (tab-content-)component and data (context/vars/pinia-store)? and window icon and window title and so on :)
Sorry, I'm not sure I understand what you mean.
Sorry, I'm not sure I understand what you mean.
In your example it seems that you can spawn only a clone of the root window. Not a certain subcomponent. Like a Gallery as a new window or complex toolbars as a new window would be beneficial. And then this new windows should communicate with the other data from the main window somehow. And it should be possible to give the new windows another name and icon to distinguish them. (As mentioned before)
Those 2 windows are entirely independent and you can have what you like in them. This was just defaulting to an external URL for demo purposes. A lot has happened in 6 months πFor more discussion on this, please join the Discord server π
Is there any ETA for v3?
No. I imagine Mac/Windows alpha might be out soon...
Multi window support has been completed for v3. Closing this.
thanks
Multi window support has been completed for v3. Closing this.
when will v3 release?
When it's ready.
Where is it documented? checked next version of docs but can't find new api https://wails.io/docs/next/reference/runtime/window
Where is it documented? checked next version of docs but can't find new api https://wails.io/docs/next/reference/runtime/window
@leaanthony how would multiple windows communicate with each other , through BroadcastChannel ? window.postMessage ?
Worth asking on the discord channel rather than this closed ticket π
@leaanthony sorry ,google search lead me here , did not realize this was closed .
Is your feature request related to a problem? Please describe.
We'd like to support multiple windows and improve the current window APIs to support it.
Describe the solution you'd like
A window-centric API eg: