Skip to content

Commit

Permalink
fix: 🐛 hide dock icon and set window always on top(#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingryan authored Apr 21, 2023
1 parent 5f76ec7 commit 9815387
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src-tauri/src/core/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,12 @@ impl Handle {
let title = window_info.title.as_str();
let url = window_info.url.as_str();

// Q: 如果有之前的窗口存在, 那就弹出之前的窗口,请补上逻辑
// A:
if let Some(window) = app_handle.get_window(label) {
let _ = window.set_always_on_top(true);
let _ = window.show();
return;
}

// Q: Tauri如何关闭Mac APP的隐藏
// A:
let new_window = tauri::window::WindowBuilder::new(
app_handle,
label.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
window.close_devtools();
}
#[cfg(target_os = "macos")]
app.set_activation_policy(tauri::ActivationPolicy::Regular);
app.set_activation_policy(tauri::ActivationPolicy::Accessory);

AppConfig::init()?;
core::handle::Handle::global().init(app.app_handle());
Expand Down

0 comments on commit 9815387

Please sign in to comment.