diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 858431ef5..c07b572fb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,6 +64,10 @@ cd frontend npm test ``` +> **Note:** After running the frontend tests, you may see a warning: +> `Jest did not exit one second after the test run has completed.` +> This is a known behavior and **does not indicate a problem** when all tests pass. It occurs due to open handles (unclosed servers, DB connections, timers, etc.) that prevent the Node process from exiting cleanly. To identify the root cause, run `npx jest --detectOpenHandles` and ensure resources are properly closed in test teardown (`afterEach`/`afterAll`). + ### Backend - FastAPI diff --git a/frontend/src-tauri/Cargo.toml b/frontend/src-tauri/Cargo.toml index c16753a36..6efc9a441 100644 --- a/frontend/src-tauri/Cargo.toml +++ b/frontend/src-tauri/Cargo.toml @@ -37,6 +37,7 @@ tauri-plugin-process = "2.3.1" tauri-plugin-store = "2.4.1" tauri-plugin-updater = "2.9.0" tauri-plugin-opener = "2.5.2" +tauri-plugin-single-instance = "2.3.1" [features] # This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! diff --git a/frontend/src-tauri/src/main.rs b/frontend/src-tauri/src/main.rs index 5b7aa6acc..8f9202d95 100644 --- a/frontend/src-tauri/src/main.rs +++ b/frontend/src-tauri/src/main.rs @@ -190,6 +190,12 @@ fn prod(_app: &tauri::AppHandle, _resource_path: &std::path::Path) -> Result<(), fn main() { tauri::Builder::default() + .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { + // When a second instance is launched, focus the primary instance's window + if let Some(window) = app.get_webview_window("main") { + let _ = window.set_focus(); + } + })) .plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_store::Builder::new().build()) diff --git a/frontend/src-tauri/tauri.conf.json b/frontend/src-tauri/tauri.conf.json index 8ad815dfd..0a12c0461 100644 --- a/frontend/src-tauri/tauri.conf.json +++ b/frontend/src-tauri/tauri.conf.json @@ -46,6 +46,7 @@ "app": { "windows": [ { + "label": "main", "title": "PictoPy", "width": 800, "height": 600, @@ -54,6 +55,7 @@ "resizable": true, "fullscreen": false, "maximized": false, + "skipTaskbar": false, "devtools": true } ],