更新Windows下代码,修复部分bug

This commit is contained in:
Tlntin
2022-12-27 23:52:41 +08:00
parent bfde2b9d87
commit 0652753a05
2 changed files with 23 additions and 38 deletions

View File

@@ -22,6 +22,8 @@ image = "0.24.5"
home = "0.5"
tauri-utils = "1.2.1"
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/tauri-plugin-window-state", branch = "dev"}
[target.'cfg(target_os = "linux")'.dependencies]
webkit2gtk = "0.18.0"
# webbrowser = "0.8.2"
# wry = "0.23.4"

View File

@@ -9,51 +9,34 @@ use app::{get_menu, menu_event_handle};
pub fn run_app() {
let system_tray = get_system_tray();
let (pake_config, tauri_config) = get_pake_config();
let data_dir = get_data_dir(tauri_config);
#[cfg(target_os = "macos")]
{
let (pake_config, _) = get_pake_config();
let tauri_app = {
let menu = get_menu();
tauri::Builder::default()
.menu(menu)
.on_menu_event(menu_event_handle)
.system_tray(system_tray)
.on_system_tray_event(system_tray_handle)
.plugin(tauri_plugin_window_state::Builder::default().build())
.invoke_handler(tauri::generate_handler![])
.setup(|app| {
let _window = get_window(app, pake_config, std::path::PathBuf::new());
#[cfg(feature = "devtools")]
{
app.get_window("pake").unwrap().open_devtools();
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
};
#[cfg(any(target_os = "linux", target_os = "windows"))]
{
let (pake_config, tauri_config) = get_pake_config();
let data_dir = get_data_dir(tauri_config);
// let menu = get_menu();
let tauri_app = {
tauri::Builder::default()
// .menu(menu)
// .on_menu_event(menu_event_handle)
.system_tray(system_tray)
.on_system_tray_event(system_tray_handle)
.plugin(tauri_plugin_window_state::Builder::default().build())
.invoke_handler(tauri::generate_handler![])
.setup(|app| {
let _window = get_window(app, pake_config, data_dir);
#[cfg(feature = "devtools")]
{
app.get_window("pake").unwrap().open_devtools();
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
};
tauri_app
.system_tray(system_tray)
.on_system_tray_event(system_tray_handle)
.plugin(tauri_plugin_window_state::Builder::default().build())
.invoke_handler(tauri::generate_handler![])
.setup(|app| {
let _window = get_window(app, pake_config, data_dir);
#[cfg(feature = "devtools")]
{
_window.open_devtools();
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
fn main() {