generated from nhcarrigan/template
feat: add close confirmation modal with minimize to tray option
Implemented a confirmation modal when users try to close the application: - Modal always shows with three options: Cancel, Minimize to Tray, Close Application - Detects if Claude is actively running and shows appropriate warning message - Removed minimize_to_tray config setting (no longer needed) - Added core:window:allow-hide permission for window hiding - Created CloseAppConfirmModal component with keyboard shortcuts (Escape to cancel) - Added close_application command to properly exit the app - Backend emits window-close-requested event for frontend to handle This provides better UX by giving users clear choices every time they close, preventing accidental closures during active work sessions.
This commit is contained in:
@@ -1154,6 +1154,19 @@ pub async fn log_discord_rpc(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn close_application(app_handle: AppHandle) -> Result<(), String> {
|
||||
// Get the main window
|
||||
if let Some(window) = app_handle.get_webview_window("main") {
|
||||
// Hide the window first for a smoother close
|
||||
let _ = window.hide();
|
||||
}
|
||||
|
||||
// Exit the application
|
||||
app_handle.exit(0);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user