From 123f5eeebe42f648e8e3013fa5b730950eebade3 Mon Sep 17 00:00:00 2001 From: FTCHD Date: Sat, 1 Feb 2025 21:01:36 +0200 Subject: [PATCH] close handling in loading tray --- lib/tray.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tray.ts b/lib/tray.ts index 0068cfc..4bfee29 100644 --- a/lib/tray.ts +++ b/lib/tray.ts @@ -4,7 +4,12 @@ import { MenuItem } from '@tauri-apps/api/menu' import { resolveResource } from '@tauri-apps/api/path' import type { TrayIconEvent } from '@tauri-apps/api/tray' import { TrayIcon } from '@tauri-apps/api/tray' -import { getAllWindows, PhysicalPosition, PhysicalSize } from '@tauri-apps/api/window' +import { + PhysicalPosition, + PhysicalSize, + getAllWindows, + getCurrentWindow, +} from '@tauri-apps/api/window' import { ask } from '@tauri-apps/plugin-dialog' import { exit } from '@tauri-apps/plugin-process' import { buildMenu } from './menu' @@ -88,6 +93,7 @@ export async function initLoadingTray() { action: async () => { const answer = await ask('An operation is in progress, are you sure you want to exit?') if (answer) { + await getCurrentWindow().emit('close-app') await exit(0) } },