mirror of
https://github.com/tauri-apps/tauri-docs.git
synced 2026-01-31 00:35:16 +01:00
(i18n-ignore) docs: restore the window if it is minimized (#2823)
Co-authored-by: Tony <legendmastertony@gmail.com>
This commit is contained in:
@@ -1048,8 +1048,9 @@ tauri::Builder::default()
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
if let Some(webview_window) = app.get_webview_window("main") {
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
let _ = webview_window.unminimize();
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -978,8 +978,9 @@ tauri::Builder::default()
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
if let Some(webview_window) = app.get_webview_window("main") {
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
let _ = webview_window.unminimize();
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1048,8 +1048,9 @@ tauri::Builder::default()
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
if let Some(webview_window) = app.get_webview_window("main") {
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
let _ = webview_window.unminimize();
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -292,6 +292,7 @@ TrayIconBuilder::new()
|
||||
// in this example, let's show and focus the main window when the tray is clicked
|
||||
let app = tray.app_handle();
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.unminimize();
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
|
||||
@@ -1056,8 +1056,9 @@ tauri::Builder::default()
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
if let Some(webview_window) = app.get_webview_window("main") {
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
let _ = webview_window.unminimize();
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -291,6 +291,7 @@ TrayIconBuilder::new()
|
||||
// 在这个例子中,当点击托盘图标时,将展示并聚焦于主窗口
|
||||
let app = tray.app_handle();
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
let _ = window.unminimize();
|
||||
let _ = window.show();
|
||||
let _ = window.set_focus();
|
||||
}
|
||||
|
||||
@@ -1049,8 +1049,9 @@ tauri::Builder::default()
|
||||
{
|
||||
let app = tray.app_handle();
|
||||
if let Some(webview_window) = app.get_webview_window("main") {
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
let _ = webview_window.unminimize();
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user