Skip to content

Commit 858a4c6

Browse files
committed
feat: 支持 Window 平台不抢占其它窗口焦点
1 parent a6fdef1 commit 858a4c6

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src-tauri/src/plugins/window/src/commands/not_macos.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
use super::{shared_hide_window, shared_show_window};
1+
use super::{is_main_window, shared_hide_window, shared_show_window};
22
use tauri::{command, AppHandle, Runtime, WebviewWindow};
33

44
// 显示窗口
55
#[command]
66
pub async fn show_window<R: Runtime>(_app_handle: AppHandle<R>, window: WebviewWindow<R>) {
7-
shared_show_window(&window);
7+
if is_main_window(&window) {
8+
let _ = window.show();
9+
let _ = window.unminimize();
10+
let _ = window.set_focusable(false);
11+
} else {
12+
shared_show_window(&window);
13+
}
814
}
915

1016
// 隐藏窗口

0 commit comments

Comments
 (0)