-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
How to create multiple separate windows, instead of "tabs"? #3912
Comments
Could you please fill out the rest of the information required like |
Sorry for for the lack of information. This is what I output under the tauri project: Environment
› OS: Mac OS 12.3.0 X64
› Node.js: 16.13.2
› npm: 8.1.2
› pnpm: Not installed!
› yarn: 1.22.17
› rustup: 1.24.3
› rustc: 1.59.0
› cargo: 1.59.0
› Rust toolchain: stable-aarch64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 1.0.0-rc.7
› @tauri-apps/api [NPM]: Not installed!
› tauri [RUST]: no manifest (no lockfile),
› tauri-build [RUST]: no manifest (no lockfile),
› tao [RUST]: no manifest (no lockfile),
› wry [RUST]: no manifest (no lockfile),
App
› build-type: bundle
› CSP: default-src 'self'
› distDir: ["index.html"]
› devPath: ["index.html"]
App directory structure
├─ .husky
├─ tooling
├─ core
├─ audits
├─ target
├─ node_modules
├─ .changes
├─ .scripts
├─ examples
├─ .github
└─ .git This is me running the "multiwindow" example (with some irrelevant js code commented out) of this project, I found that all windows created by rust become tabs of a window, and all windows created by js are in another window: output.mp4 |
This behavior is a configuration option in your macOS System Preferences. Open the |
@lucasfernog Thanks for pointing out, but I think the problem is only partially solved, why the first click of the Let me change the question to, how do I make sure that I can create multiple separate windows when I want to? |
I don't think we're doing anything special in this case, but i'll reopen so we can track it. |
Looks like we can use |
Now that v1 was released, is this now available/achievable? |
any code example pls?? #[allow(dead_code)]
#[tauri::command]
async fn open_docs() {
let handle: tauri::AppHandle = tauri::AppHandle();
let docs_window = tauri::WindowBuilder::new(
&handle,
"external", /* the unique window label */
tauri::WindowUrl::External("https://tauri.app/".parse().unwrap()),
).build().unwrap();
} |
@aliscie inject the app handle like this and it should work: https://tauri.app/v1/guides/features/command#accessing-an-apphandle-in-commands |
in the frontend how can I run this? //my rust frontend
let app_handle = somthing_that_i_dont_know
spawn_local(async move {
invoke_async("my_custom_command",(app_handle,)).await
}); My tasks is very simple, i just have a button and I need to open new dinow when i click it. |
i don't know anything about rust frontends tbh, but you don't need to inject the app_handle yourself, Tauri injects it for you (in that regard rust frontends are the same as js frontends) |
This is what I have in the #[cfg(target_os = "macos")]
{
// Disable the automatic creation of "Show Tab Bar" etc menu items on macOS
let window = app.get_window("main").unwrap();
unsafe {
let ns_window = window.ns_window().unwrap() as cocoa::base::id;
NSWindow::setAllowsAutomaticWindowTabbing_(ns_window, cocoa::base::NO);
}
} |
Windows created by
App::create_window()
are just like tabs, sharing a same window, but I want they each had a separate window, can tauri do this? If so, how?Sorry if I've missed anything, but i've been googling for a long time, checked the docs and issues of tauri and tao, got nothing at all.
The text was updated successfully, but these errors were encountered: