[deskotp/tauri] update tauri, remove the need for nsis template
This commit is contained in:
@@ -3,10 +3,11 @@ use std::sync::Mutex;
|
||||
use std::{collections::HashMap, sync::atomic::Ordering};
|
||||
|
||||
use log::{debug, error};
|
||||
use tauri::tray::{MouseButton, MouseButtonState};
|
||||
use tauri::{
|
||||
image::Image,
|
||||
menu::{MenuBuilder, MenuItem, MenuItemBuilder, PredefinedMenuItem, SubmenuBuilder},
|
||||
tray::{ClickType, TrayIcon, TrayIconBuilder},
|
||||
tray::{TrayIcon, TrayIconBuilder},
|
||||
Wry,
|
||||
};
|
||||
|
||||
@@ -158,8 +159,20 @@ pub fn setup_tray_menu(
|
||||
})
|
||||
.on_tray_icon_event(|tray, event| {
|
||||
// not supported on linux
|
||||
if event.click_type == ClickType::Left {
|
||||
let _ = open_window(tray.app_handle());
|
||||
|
||||
if let tauri::tray::TrayIconEvent::Click {
|
||||
id: _,
|
||||
position: _,
|
||||
rect: _,
|
||||
button,
|
||||
button_state,
|
||||
} = event
|
||||
{
|
||||
if let MouseButton::Left = button {
|
||||
if let MouseButtonState::Down = button_state {
|
||||
let _ = open_window(tray.app_handle());
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.build(app)?;
|
||||
|
||||
@@ -80,7 +80,8 @@ pub fn create_splash_window(app: &AppHandle) -> Result<WebviewWindow> {
|
||||
|
||||
pub fn close_splash_window(app: &AppHandle) -> Result<()> {
|
||||
if let Some(window) = app.get_webview_window("splash") {
|
||||
return window.hide();
|
||||
let _ = window.hide();
|
||||
return window.destroy();
|
||||
}
|
||||
return Err(tauri::Error::WindowNotFound);
|
||||
}
|
||||
@@ -131,8 +132,7 @@ pub fn may_navigate_to_ui(win: &mut WebviewWindow, force: bool) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if force || cfg!(debug_assertions) || win.url().unwrap().as_str() == "tauri://localhost" {
|
||||
if force || win.label().eq("main") {
|
||||
#[cfg(debug_assertions)]
|
||||
if let Ok(target_url) = std::env::var("TAURI_PM_URL") {
|
||||
debug!("[tauri] navigating to {}", target_url);
|
||||
|
||||
Reference in New Issue
Block a user