mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-08 22:05:16 +02:00
Shared window crate
This commit is contained in:
@@ -13,6 +13,8 @@ crate-type = ["staticlib", "cdylib", "lib"]
|
||||
tauri-build = { version = "2.5.3", features = [] }
|
||||
|
||||
[dependencies]
|
||||
log = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
tauri = { workspace = true }
|
||||
yaak-proxy = { workspace = true }
|
||||
yaak-window = { workspace = true }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
use log::error;
|
||||
use serde::Serialize;
|
||||
use std::sync::Mutex;
|
||||
use tauri::State;
|
||||
use tauri::{RunEvent, State};
|
||||
use yaak_proxy::ProxyHandle;
|
||||
use yaak_window::window::CreateWindowConfig;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -58,6 +60,22 @@ pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.manage(ProxyState::default())
|
||||
.invoke_handler(tauri::generate_handler![proxy_metadata, proxy_start, proxy_stop])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running yaak proxy tauri application");
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building yaak proxy tauri application")
|
||||
.run(|app_handle, event| {
|
||||
if let RunEvent::Ready = event {
|
||||
let config = CreateWindowConfig {
|
||||
url: "/",
|
||||
label: "main",
|
||||
title: "Yaak Proxy",
|
||||
inner_size: Some((1000.0, 700.0)),
|
||||
visible: true,
|
||||
hide_titlebar: true,
|
||||
..Default::default()
|
||||
};
|
||||
if let Err(e) = yaak_window::window::create_window(app_handle, config) {
|
||||
error!("Failed to create proxy window: {e:?}");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,16 +10,7 @@
|
||||
},
|
||||
"app": {
|
||||
"withGlobalTauri": false,
|
||||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "Yaak Proxy",
|
||||
"width": 1000,
|
||||
"height": 700,
|
||||
"minWidth": 720,
|
||||
"minHeight": 480
|
||||
}
|
||||
]
|
||||
"windows": []
|
||||
},
|
||||
"bundle": {
|
||||
"icon": [
|
||||
|
||||
Reference in New Issue
Block a user