mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-22 08:38:29 +02:00
Shared window crate
This commit is contained in:
@@ -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:?}");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user