Create webview window in rust

This commit is contained in:
Lncvrt committed 2025-07-29 16:07:59 -07:00
1 parent 59e4748a64
commit 47849529f2
2 files changed
+11 -21

No files matched your search

+10 -8
View File
@@ -1,4 +1,4 @@
use tauri::{Manager, PhysicalSize}; use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
@@ -11,13 +11,15 @@ pub fn run() {
})) }))
.invoke_handler(tauri::generate_handler![]) .invoke_handler(tauri::generate_handler![])
.setup(|app| { .setup(|app| {
let window = app.get_webview_window("main").unwrap(); tauri::webview::WebviewWindowBuilder::new(
let mut url = window.url().unwrap(); app,
url.set_path("/projectmanager.html"); "main",
window.navigate(url).unwrap(); tauri::WebviewUrl::App("projectmanager.html".into()),
window.set_resizable(false).unwrap(); )
window.set_size(PhysicalSize::new(800, 500)).unwrap(); .resizable(false)
window.set_title("Project Manager").unwrap(); .title("Code Fly")
.inner_size(800.0, 500.0)
.build()?;
Ok(()) Ok(())
}) })
.run(tauri::generate_context!()) .run(tauri::generate_context!())
+1 -13
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "PHP Fly", "productName": "PHP Fly",
"version": "0.1.0", "version": "1.0.0",
"identifier": "xyz.lncvrt.php-fly", "identifier": "xyz.lncvrt.php-fly",
"build": { "build": {
"beforeDevCommand": "yarn dev", "beforeDevCommand": "yarn dev",
@@ -9,18 +9,6 @@
"beforeBuildCommand": "yarn build", "beforeBuildCommand": "yarn build",
"frontendDist": "../dist" "frontendDist": "../dist"
}, },
"app": {
"windows": [
{
"title": "PHP Fly",
"width": 800,
"height": 600
}
],
"security": {
"csp": null
}
},
"bundle": { "bundle": {
"active": true, "active": true,
"targets": "all", "targets": "all",