From ce1712fed1d9f158a4717d3855be1618806ab8e7 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 13 Jan 2025 19:53:00 -0800 Subject: [PATCH] fix: electron api --- src/routes/+layout.svelte | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index a9b698065..f4e15ff43 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -105,9 +105,12 @@ let isFocused = document.visibilityState !== 'visible'; if (window.electronAPI) { - isFocused = await window.electronAPI.send({ + const res = await window.electronAPI.send({ type: 'window:isFocused' }); + if (res) { + isFocused = res.isFocused; + } } if ((event.chat_id !== $chatId && !$temporaryChatEnabled) || isFocused) { @@ -155,9 +158,12 @@ let isFocused = document.visibilityState !== 'visible'; if (window.electronAPI) { - isFocused = await window.electronAPI.send({ + const res = await window.electronAPI.send({ type: 'window:isFocused' }); + if (res) { + isFocused = res.isFocused; + } } if ((!channel || isFocused) && event?.user?.id !== $user?.id) {