diff --git a/package-lock.json b/package-lock.json index 761f5ac..2c0c465 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "devDependencies": { "@tailwindcss/postcss": "^4.1.18", "@tauri-apps/cli": "^2.10.0", + "@types/node": "^25.2.3", "@types/react": "^19.2.13", "@types/react-dom": "^19.2.3", "@types/react-window": "^2.0.0", @@ -2039,6 +2040,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "25.2.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.3.tgz", + "integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, "node_modules/@types/react": { "version": "19.2.13", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.13.tgz", @@ -4152,6 +4163,13 @@ "typescript": ">=4.8.4 <6.0.0" } }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz", diff --git a/package.json b/package.json index ab864ec..4036df6 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "devDependencies": { "@tailwindcss/postcss": "^4.1.18", "@tauri-apps/cli": "^2.10.0", + "@types/node": "^25.2.3", "@types/react": "^19.2.13", "@types/react-dom": "^19.2.3", "@types/react-window": "^2.0.0", diff --git a/scripts/install.sh b/scripts/install.sh index 3cd0346..c0d759a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -439,8 +439,6 @@ sanitize_xdg_data_dirs() { } sanitize_xdg_data_dirs -export GDK_SCALE="${GDK_SCALE:-1}" -export GDK_DPI_SCALE="${GDK_DPI_SCALE:-1}" export NO_AT_BRIDGE=1 exec "$HOME/.local/bin/win11-clipboard-history.AppImage" "$@" diff --git a/src-tauri/bundle/linux/wrapper.sh b/src-tauri/bundle/linux/wrapper.sh index f8ec246..48d6f18 100755 --- a/src-tauri/bundle/linux/wrapper.sh +++ b/src-tauri/bundle/linux/wrapper.sh @@ -139,8 +139,6 @@ fi # --------------------------------------------------------------------------- # Display & rendering defaults # --------------------------------------------------------------------------- -export GDK_SCALE="${GDK_SCALE:-1}" -export GDK_DPI_SCALE="${GDK_DPI_SCALE:-1}" export TAURI_TRAY="${TAURI_TRAY:-libayatana-appindicator3}" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index f4a43d1..20c2bf1 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -274,6 +274,30 @@ async fn copy_text_to_clipboard(_state: State<'_, AppState>, text: String) -> Re Ok(()) } +#[tauri::command] +async fn finish_setup(app: AppHandle) -> Result<(), String> { + // 1. Mark first run as complete (redundant but safe) + win11_clipboard_history_lib::permission_checker::mark_first_run_complete() + .map_err(|e| e.to_string())?; + + // 2. Close setup window + if let Some(setup_window) = app.get_webview_window("setup") { + let _ = setup_window.close(); + } + + // 3. Show main window + if let Some(main_window) = app.get_webview_window("main") { + // Ensure it's ready to be shown + WindowController::position_and_show(&main_window, &app); + } + + // 4. Emit event to main window to update its state (stop waiting) + // We emit to all just in case, or specifically to main + let _ = app.emit("setup_complete", ()); + + Ok(()) +} + // --- Helper for Paste Logic --- struct PasteHelper; @@ -773,6 +797,19 @@ fn main() { config_manager: config_manager.clone(), is_mouse_inside: is_mouse_inside.clone(), }) + .on_window_event(|window, event| { + if let tauri::WindowEvent::Destroyed = event { + if window.label() == "setup" { + // Check if setup was effectively finished. + // If the user clicked "Start Using", `finish_setup` would have been called. + // `finish_setup` calls `mark_first_run_complete`. + if win11_clipboard_history_lib::permission_checker::is_first_run() { + println!("[Setup] Setup window closed without completion. Exiting app."); + window.app_handle().exit(0); + } + } + } + }) .setup(move |app| { let app_handle = app.handle().clone(); @@ -985,6 +1022,7 @@ fn main() { get_recent_emojis, paste_gif_from_url, finish_paste, + finish_setup, // Register the new command set_mouse_state, get_user_settings, set_user_settings, diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index c60715d..e0addc1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -31,6 +31,22 @@ "alwaysOnTop": true, "focus": true }, + { + "title": "Setup - Clipboard History", + "label": "setup", + "width": 550, + "height": 650, + "resizable": true, + "minWidth": 400, + "minHeight": 500, + "decorations": true, + "transparent": false, + "visible": false, + "skipTaskbar": false, + "alwaysOnTop": false, + "center": true, + "focus": true + }, { "title": "Settings - Clipboard History", "label": "settings", @@ -52,7 +68,11 @@ }, "bundle": { "active": true, - "targets": ["deb", "rpm", "appimage"], + "targets": [ + "deb", + "rpm", + "appimage" + ], "icon": [ "icons/32x32.png", "icons/64x64.png", @@ -104,6 +124,8 @@ "preRemoveScript": "bundle/linux/postrm.sh" } }, - "resources": ["bundle/linux/99-win11-clipboard-input.rules"] + "resources": [ + "bundle/linux/99-win11-clipboard-input.rules" + ] } -} +} \ No newline at end of file diff --git a/src/components/SetupWizard.tsx b/src/components/SetupWizard.tsx index 58a7d22..b90859f 100644 --- a/src/components/SetupWizard.tsx +++ b/src/components/SetupWizard.tsx @@ -666,22 +666,19 @@ export function SetupWizard({ onComplete }: SetupWizardProps) { } return ( -