how to create a window with custom url #13497
-
use tauri::{AppHandle, Manager, Window};
pub fn create_gray_window(app_handle: &AppHandle){
let monitors = app_handle.available_monitors().unwrap();
println!("{:?}", monitors);
let has_main = app_handle.get_window("main");
if let Some(win) = has_main {
win.set_focus().unwrap();
} else {
let win = Window::builder(app_handle, "main")
.build()
.unwrap();
// TODO!! win.seturl
win.set_focus().unwrap();
}
} i have set the [package]
name = "tauri-v2-project"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
# The `_lib` suffix may seem redundant but it is necessary
# to make the lib name unique and wouldn't conflict with the bin name.
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519
name = "tauri_v2_project_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = ["unstable", "webview-data-url", "tray-icon", ] }
tauri-plugin-opener = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-global-shortcut = "2" |
Beta Was this translation helpful? Give feedback.
Answered by
FabianLars
May 23, 2025
Replies: 1 comment 2 replies
-
I think you're looking for |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
liuxsen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think you're looking for
WebviewWindow
, notWindow