Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat: enhance application run logic to handle macOS window reopening

t8y23cd328ece877
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 56a75c56eb..0db3e20626 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -4,7 +4,7 @@ mod models;
use commands::connection::AppState;
use std::sync::Arc;
-use tauri::Manager;
+use tauri::{Manager, RunEvent};
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
@@ -97,6 +97,17 @@ pub fn run() {
commands::transfer::start_transfer,
commands::transfer::cancel_transfer,
])
- .run(tauri::generate_context!())
- .expect("error while running tauri application");
+ .build(tauri::generate_context!())
+ .expect("error while building tauri application")
+ .run(|app_handle, event| {
+ #[cfg(target_os = "macos")]
+ if let RunEvent::Reopen { has_visible_windows, .. } = &event {
+ if !has_visible_windows {
+ if let Some(window) = app_handle.get_webview_window("main") {
+ let _ = window.show();
+ let _ = window.set_focus();
+ }
+ }
+ }
+ });
}